You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Impeller] Unified Vulkan transient attachment caching in Impeller core #194239
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
andywolff commentedon Oct 12, 2026
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
ContextVKand having it clearable on low memory events will apply to Android as well.