Skip to content

gpu: Split out the cache

Benjamin Otte requested to merge wip/otte/for-main into main

This splits out the cache into its own GskGpuCache object.

This is for 3 reasons:

  1. Separation of concerns
    The device is meant to manage the Vulkan/GL device and check stuff like image sizes.
    Caching is not part of that.

  2. Refcounting
    Images etc want to reference the device, but the cache wants to reference images. If the cache is the device, that's a refcycle.

  3. Flexibility
    It's now easier to implement >1 cache, say one per depth or one per color state.

Also included is a change to gc'ing - we keep running the timer now, so that we can also collect the atlas. The main goal with that is making sure the whole cache can get collected.
I want to have this available so that when we use per-colorstate caching in the future, we don't "leak" caches when colorstates stop being used for compositing (like when switching off HDR or moving a window between monitors).

Edited by Benjamin Otte

Merge request reports

Loading