Skip to content

[Impeller] Fix Windows support (broken by flutter/engine#49726) #141482

@loic-sharma

Description

@loic-sharma

Problem

flutter/engine#49726 breaks Windows's support for Impeller. We should update Impeller so that it can be used on Windows again. /cc @jonahwilliams

Crash call stack:

flutter::`anonymous namespace'::GetOpenGLRendererConfig::<lambda_27>::__invoke(void * user_data, const FlutterFrameInfo * info)
InferOpenGLPlatformViewCreationCallback::<lambda_4>::operator()(...)
...
flutter::EmbedderSurfaceGLImpeller::GLContextFBO(...)
flutter::GPUSurfaceGLImpeller::AcquireFrame(...)
flutter::Rasterizer::DrawToSurfaceUnsafe(...)
flutter::Rasterizer::DrawToSurfacesUnsafe(...)
flutter::Rasterizer::DrawToSurfaces(...)
flutter::Rasterizer::DoDraw(...)
flutter::Rasterizer::Draw::<lambda>(...)
...
flutter::Pipeline<flutter::FrameItem>::Consume(...)
flutter::Rasterizer::Draw(...)
flutter::Shell::OnAnimatorDraw::<lambda_37>::operator()()
...

The crashing lambda is Flutter Windows's FlutterOpenGLRendererConfig.fbo_with_frame_info_callback.

Root cause

GPUSurfaceGLImpeller::AcquireFrame always uses FlutterOpenGLRendererConfig.fbo_with_frame_info_callback to get an FBO.

This is incorrect if the embedder has registered a FlutterCompositor. Instead, GPUSurfaceGLImpeller should use backing stores (FlutterOpenGLTexture or FlutterOpenGLFramebuffer) created by the FlutterCompositor.

This fix is also necessary for Linux support as its embedder also registers a FlutterCompositor.

How to enable Impeller when launching a Flutter Windows app under a debugger

Update your .exe's launch configuration:

  1. Use --enable-impeller=true as your arguments
  2. Add the following environment variables:
    1. FLUTTER_ENGINE_SWITCHES: 1
    2. FLUTTER_ENGINE_SWITCH_1: enable-impeller=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: desktopRunning on desktopc: regressionIt was better in the past than it is nowe: impellerImpeller rendering backend issues and features requestsplatform-windowsBuilding on or for Windows specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions