Skip to content

[Windows] Improve performance by removing intermediary texture & blit #146013

@loic-sharma

Description

@loic-sharma

Background

The engine asks the Windows embedder for "backing stores" to render into. Previously, the engine treated backing stores of the same size as fully interchangeable. This was a problem as Windows's EGL surfaces are specific to a view. As a result, Windows's EGL surfaces could not be used directly as a backing store.

To workaround this, the Windows embedder creates intermediary textures for the engine's backing stores. The Windows embedder then blits these intermediary textures to the correct window surface.

This approach has drawbacks:

  1. It greatly increases memory usage (a window needs a front buffer, a back buffer, and an intermediary texture).
  2. It requires a blit from the intermediary texture to the back buffer.
  3. It fails if the machine does not support OpenGL blit: Windows Flutter apps crash silently on some machines after 3.27.4 #169178

This workaround is no longer necessary now that the Flutter engine's backing stores are view-specific. See: #145522

Solution

The Windows embedder should use the window's back buffer as the backing store. This should mirror how backing stores work on macOS.

Part of #142845

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.platform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions