Skip to content

[Impeller] Unified Vulkan transient attachment caching in Impeller core #194239

Open

Description

@andywolff

When Impeller renders into a Vulkan render target, it requires 4x MSAA color and depth-stencil transient attachments. On mobile GPUs with lazy memory allocation or Apple Metal memoryless attachments, these buffers reside in on-chip tile memory with no host RAM footprint. On desktop Linux, Wayland/DRM-KMS embedders, and embedded GPUs like Raspberry Pi Broadcom VideoCore (V3D 4.2), lazy allocation is unsupported. Benchmarks from @jwinarske on V3D 4.2 show that allocating these buffers per frame on scanout rings creates ~60 MB of allocation churn per frame (at 1280x1440 with 4x MSAA) and drops framerates from 58.8 fps to 23.5 fps.

An earlier iteration of #193003 explored caching these transient textures directly inside embedder.cc. While that benchmark proved the necessity of caching on embedded scanout rings, the embedder shell is the wrong architectural home for managing GPU texture lifecycles. Caching at the shell layer duplicates the transients cache already present in GPUSurfaceVulkanImpeller, and textures held in shell closures cannot respond to engine memory pressure notifications or cache trimming.

Directionally, we should consolidate transient texture caching into Impeller's core Vulkan backend rather than maintaining separate caches across the shell.

I propose moving transient texture memoization into impeller::ContextVK, keyed by TextureDescriptor. Cached instances can hold a std::weak_ptr<DeviceHolderVK> so they drop cleanly if the context or device is destroyed. Both embedder.cc and GPUSurfaceVulkanImpeller can then share this single caching mechanism and participate in engine-level memory trimming.

Activity

  1. andywolff commented on Oct 12, 2026

    @andywolff
    ContributorAuthor

    Under RFC 410 (flutter/rfc#24), Android will also use Vulkan backing stores via embedder.h for platform views.

    This means the benefits of consolidating the cache in ContextVK and having it clearable on low memory events will apply to Android as well.

  2. added
    in triagePresently being triaged by the triage team
    engineflutter/engine related. See also e: labels.
    e: impellerImpeller rendering backend issues and features requests
    c: proposalA detailed proposal for a change to Flutter
    and removed
    in triagePresently being triaged by the triage team
    on Oct 13, 2026
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

    c: proposalA detailed proposal for a change to Fluttere: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions