diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-31 22:18:15 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-31 22:18:15 -0400 |
| commit | 5de94bdd1d2441c0dba30456a7865756980a4ab1 (patch) | |
| tree | 43fc481ac94ae48c70c81aada247765702bdc669 /src/video_core/renderer_vulkan | |
| parent | be76402ab51deb40c8dea57f66078a19e4a561b2 (diff) | |
vk_pipeline_cache: build only the last two sessions' pipelines at boot
Each pipeline built at boot holds ~0.45 MB of driver memory. Mario Kart
World built 4,789 from the eight sessions the list kept, while one
session of its title screen uses ~1,500. With the last two sessions it
built 1,035 at boot and 972 when first needed: the emulator's own memory
at five minutes 6.4 -> 5.6 GB, frames over 100 ms 9 -> 10 (none built at
boot: 4.9 GB, but 38 frames over 100 ms). Lists saved with the longer
window are trimmed when they are loaded.
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index e369caa58f..f877b9d341 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -563,7 +563,10 @@ namespace { // <title>/vulkan_used.bin: the graphics pipelines recent sessions used, as key hash + sessions // since the last use. constexpr u32 UsedPipelinesMagic = 0x31505545; // "EUP1" -constexpr u8 UsedPipelinesMaxAge = 8; +// Pipelines the last two sessions used are built at boot. Each holds ~0.45 MB of driver memory: +// title 1 built 4,800 from eight sessions, 1.5 GB more than building them on first use (but that +// stalled frames 4x as often), while one session of its title screen uses ~1,500. +constexpr u8 UsedPipelinesMaxAge = 2; std::unordered_map<u64, u8> LoadUsedPipelines(const std::filesystem::path& path) { std::unordered_map<u64, u8> used; @@ -581,7 +584,9 @@ std::unordered_map<u64, u8> LoadUsedPipelines(const std::filesystem::path& path) !file.read(reinterpret_cast<char*>(&age), sizeof(age))) { break; } - used.emplace(hash, age); + if (age < UsedPipelinesMaxAge) { // lists saved with a longer window + used.emplace(hash, age); + } } return used; } |
