Skip to content

[Impeller] [Windows] Flutter gpu sample fails on windows with Flutter GPU must be enabled via the Flutter GPU manifest setting #167734

Open

Description

@RequieMa

Steps to reproduce

I'm trying to run code at https://medium.com/flutter/getting-started-with-flutter-gpu-f33d497b7c11 on Windows, but doesn't work well...

Steps to reproduce

codes are basically from the link

flutter channel master
flutter upgrade
flutter pub add flutter_gpu --sdk=flutter
flutter pub add flutter_gpu_shaders
flutter config --enable-native-assets
flutter pub add native_assets_cli
flutter run -d windows --enable-impeller

Expected results

I expect to see

flutter: Default color format: PixelFormat.b8g8r8a8UNormInt

with a black screen window

Actual results

I do see a black screen window. But I don't see any print in cmd.

The log shows a stack of functional calls, but I don't find the exception useful. Please help!

Code sample

Code sample
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter_gpu/gpu.dart' as gpu;

// NOTE: We made this earlier while setting up shader bundle imports!
import 'shaders.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter GPU Triangle Example',
      home: CustomPaint(
        painter: TrianglePainter(),
      ),
    );
  }
}

class TrianglePainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    print('Default color format: ' +
        gpu.gpuContext.defaultColorFormat.toString());
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
}

Screenshots or Video

Logs

Logs
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on Windows in debug mode...
Building Windows application...                                     7.6s
√ Built build\windows\x64\runner\Debug\my_cool_renderer.exe
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(99)] Using the Impeller rendering backend (OpenGL).
Syncing files to device Windows...                                  31ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Windows is available at: http://127.0.0.1:50657/dhu2YEPaDBU=/

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following _Exception was thrown during paint():
Exception: Flutter GPU must be enabled via the Flutter GPU manifest setting. This can be done either
via command line argument --enable-flutter-gpu or by adding the FLTEnableFlutterGPU key set to true
on iOS or io.flutter.embedding.android.EnableFlutterGPU metadata key to true on Android.

The relevant error-causing widget was:
  CustomPaint CustomPaint:file:///E:/dev/flutterProjects/my_cool_renderer/lib/main.dart:21:13

When the exception was thrown, this was the stack:
#0      new GpuContext._createDefault (package:flutter_gpu/src/context.dart:18:7)
#1      gpuContext (package:flutter_gpu/src/context.dart:187:42)
#2      gpuContext (package:flutter_gpu/src/context.dart)
#3      TrianglePainter.paint (package:my_cool_renderer/main.dart:32:13)
#4      RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:593:13)
#5      RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:641:7)
#6      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#7      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#8      RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#9      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#10     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#11     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#12     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#13     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:176:11)
#14     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:121:5)
#15     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:272:7)
#16     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:7)
#17     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#18     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#19     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#20     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#21     _ZoomExitTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1452:21)
#22     _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:337:15)
#23     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#24     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#25     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#26     _ZoomEnterTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1357:21)
#27     _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:337:15)
#28     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#29     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#30     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#31     _ZoomExitTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1452:21)
#32     _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:337:15)
#33     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#34     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#35     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#36     _ZoomEnterTransitionPainter.paint (package:flutter/src/material/page_transitions_theme.dart:1357:21)
#37     _RenderSnapshotWidget.paint (package:flutter/src/widgets/snapshot_widget.dart:337:15)
#38     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#39     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#40     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#41     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#42     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:176:11)
#43     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:121:5)
#44     PaintingContext._compositeChild (package:flutter/src/rendering/object.dart:272:7)
#45     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:253:7)
#46     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#47     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#48     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#49     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#50     RenderOffstage.paint (package:flutter/src/rendering/proxy_box.dart:3877:11)
#51     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#52     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#53     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#54     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#55     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#56     _RenderTheaterMixin.paint (package:flutter/src/widgets/overlay.dart:1120:15)
#57     _RenderTheater.paint (package:flutter/src/widgets/overlay.dart:1478:13)
#58     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#59     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#60     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#61     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#62     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#63     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#64     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#65     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#66     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#67     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#68     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#69     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#70     RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:644:11)
#71     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#72     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#73     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#74     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#75     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#76     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#77     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#78     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#79     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#80     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#81     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#82     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#83     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#84     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#85     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#86     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#87     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#88     RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:13)
#89     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#90     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:261:13)
#91     RenderView.paint (package:flutter/src/rendering/view.dart:322:15)
#92     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3483:7)
#93     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:176:11)
#94     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:121:5)
#95     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1312:31)
#96     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:1322:15)
#97     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:631:23)
#98     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1231:13)
#99     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#100    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1438:15)
#101    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1351:9)
#102    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1060:9)
#103    PlatformDispatcher.scheduleWarmUpFrame.<anonymous closure> (dart:ui/platform_dispatcher.dart:889:16)
#107    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)
(elided 3 frames from class _Timer and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderCustomPaint#60561:
  creator: CustomPaint ← Semantics ← Builder ← RepaintBoundary-[GlobalKey#72ac7] ← IgnorePointer ←
    ListenableBuilder ← SnapshotWidget ← _ZoomExitTransition ← SnapshotWidget ← _ZoomEnterTransition ←
    DualTransitionBuilder ← SnapshotWidget ← ⋯
  parentData: <none> (can use size)
  constraints: BoxConstraints(w=1264.0, h=681.0)
  size: Size(1264.0, 681.0)
  painter: TrianglePainter#c03f1()
This RenderObject has no descendants.
════════════════════════════════════════════════════════════════════════════════════════════════════

The Flutter DevTools debugger and profiler on Windows is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:50657/dhu2YEPaDBU=/
Lost connection to device.

Flutter Doctor output

Doctor output
[√] Flutter (Channel master, 3.32.0-1.0.pre.228, on Microsoft Windows [版本 10.0.19045.5737], locale zh-CN) [9.8s]
    • Flutter version 3.32.0-1.0.pre.228 on channel master at E:\dev\devTools\Flutter\dev\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 138b10a68b (65 minutes ago), 2025-04-24 10:59:39 -0400
    • Engine revision 138b10a68b
    • Dart version 3.9.0 (build 3.9.0-51.0.dev)
    • DevTools version 2.45.0
    • Pub download mirror https://pub.dev
    • Flutter download mirror https://storage.flutter-io.cn

[√] Windows Version (10 专业版 64 位, 22H2, 2009) [3.5s]

[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [3.8s]
    • Android SDK at E:\Users\86139\AppData\Local\Android\Sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = E:\Users\86139\AppData\Local\Android\Sdk
    • ANDROID_SDK_ROOT = E:\Users\86139\AppData\Local\Android\Sdk
    • Java binary at: E:\Program Files\Java\jdk-23\bin\java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version Java(TM) SE Runtime Environment (build 23.0.1+11-39)
    • All Android licenses accepted.

[√] Chrome - develop for the web [75ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4) [75ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34031.279
    • Windows 10 SDK version 10.0.20348.0

[√] Android Studio (version 2024.2) [11ms]
    • Android Studio at E:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)

[√] Proxy Configuration [248ms]
    • HTTP_PROXY is set
    • NO_PROXY is 127.0.0.1,localhost,::1,10.0.2.2,http://127.0.0.1:54462
    • NO_PROXY contains localhost
    • NO_PROXY contains ::1
    • NO_PROXY contains 127.0.0.1

[√] Connected device (3 available) [351ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [版本 10.0.19045.5737]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 119.0.6045.160
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 127.0.2651.74

[√] Network resources [1,722ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. added
    in triage
    on Apr 25, 2025
  2. changed the title [-][Impeller] [Windows] Cannot run Impeller on Windows[/-] [+][Impeller] [Windows] Flutter gpu sample fails on windows with `Flutter GPU must be enabled via the Flutter GPU manifest setting`[/+] on Apr 25, 2025
  3. danagbemava-nc commented on Apr 25, 2025

    @danagbemava-nc
    Member

    Reproducible following the steps in the flutter gpu post on medium.

    flutter doctor -v
    [✓] Flutter (Channel master, 3.32.0-1.0.pre.245, on Microsoft Windows [Version 10.0.26100.3194], locale en-US) [4.4s]
        • Flutter version 3.32.0-1.0.pre.245 on channel master at C:\Users\Deana\fvm\versions\master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision b9e982614b (8 hours ago), 2025-04-24 21:50:42 -0400
        • Engine revision b9e982614b
        • Dart version 3.9.0 (build 3.9.0-52.0.dev)
        • DevTools version 2.45.0
    
    [✓] Windows Version (11 Home 64-bit, 24H2, 2009) [3.5s]
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [4.2s]
        • Android SDK at C:\Users\Deana\AppData\Local\Android\sdk
        • Emulator version 33.1.23.0 (build_id 11150993) (CL:N/A)
        • Platform android-35, build-tools 34.0.0
        • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web [114ms]
        • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
    
    [✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.2) [113ms]
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
        • Visual Studio Community 2022 version 17.8.34322.80
        • Windows 10 SDK version 10.0.22621.0
    
    [✓] Android Studio (version 2023.1) [22ms]
        • Android Studio at C:\Program Files\Android\Android Studio
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-b2043.56-10550314)
    
    [✓] VS Code (version 1.98.0) [20ms]
        • VS Code at C:\Users\Deana\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.108.0
    
    [✓] Connected device (3 available) [403ms]
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.3194]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 135.0.7049.95
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 135.0.3179.85
    
    [✓] Network resources [1,494ms]
        • All expected network resources are available.
    
    • No issues found!
    
  4. added
    engine
    platform-windows
    has reproducible steps
    e: impeller
    team-engine
    found in release: 3.29
    found in release: 3.32
    and removed
    in triage
    on Apr 25, 2025
  5. moved this to 🤔 Needs Triage in Flutter GPUon Apr 25, 2025
  6. RequieMa commented on Apr 26, 2025

    @RequieMa
    Author

    Hi,
    I see the title is change to "must be enabled via the Flutter GPU manifest setting". How to do this on Windows?

  7. added
    P3
    triaged-engine
    on Apr 28, 2025
  8. eskov-ea commented on May 1, 2025

    @eskov-ea

    I am experiencing the same problem on macos. I tried to use --enable-flutter-gpu as args to be attached to the device but no luck. Also tried to put FLTEnableFlutterGPU set to TRUE in info.plist on macos and ios. Didn't worked out

  9. ifgotmoney commented on May 1, 2025

    @ifgotmoney

    same thing here.

    btw, I'm trying flutter_gpu on windows platform to do something that can be done with direct2d in the past, when will the flutter_gpu be officially available on windows? could we have more guide/tutorial for windows platform?

  10. RequieMa commented on May 15, 2025

    @RequieMa
    Author

    Hi there,

    Any feedback or progress?

  11. lijialin9 commented on Oct 7, 2025

    @lijialin9

    Pass the parameters through the flutter command line enable-impeller and enable-flutter-gpu work, but in runner / main.cc the Settings parameter does not work, and that is, the generated exe program directly double-click run, I looked at the source, he just made a judgment, according to Dart: : Current () to get the content, but can not find the path to set it, error tips are a bit outdated, can not find the relevant documentation, source compilation environment set up there is no clear documentation, I did not successfully build the source environment, so can not look up the source code through the IDE, I just looked at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3e: impellerengineflutter-gpufound in release: 3.29found in release: 3.32has reproducible stepsplatform-windowsteam-enginetriaged-engine

    Type

    No type

    Projects

    • Status
      🤔 Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions