perf: add Vulkan pipeline cache persistence for faster startup

Create a VkPipelineCache at device init, loaded from disk if available.
All 65 pipeline creation calls across 19 renderer files now use the
shared cache. On shutdown, the cache is serialized to disk so subsequent
launches skip redundant shader compilation.

Cache path: ~/.local/share/wowee/pipeline_cache.bin (Linux),
~/Library/Caches/wowee/ (macOS), %APPDATA%\wowee\ (Windows).
Stale/corrupt caches are handled gracefully (fallback to empty cache).
This commit is contained in:
Kelsi 2026-03-24 09:47:03 -07:00
parent c18720f0f0
commit c8c01f8ac0
23 changed files with 192 additions and 72 deletions

View file

@ -107,7 +107,7 @@ bool Lightning::initialize(VkContext* ctx, VkDescriptorSetLayout perFrameLayout)
.setLayout(boltPipelineLayout)
.setRenderPass(vkCtx->getImGuiRenderPass())
.setDynamicStates(dynamicStates)
.build(device);
.build(device, vkCtx->getPipelineCache());
vertModule.destroy();
fragModule.destroy();
@ -169,7 +169,7 @@ bool Lightning::initialize(VkContext* ctx, VkDescriptorSetLayout perFrameLayout)
.setLayout(flashPipelineLayout)
.setRenderPass(vkCtx->getImGuiRenderPass())
.setDynamicStates(dynamicStates)
.build(device);
.build(device, vkCtx->getPipelineCache());
vertModule.destroy();
fragModule.destroy();
@ -306,7 +306,7 @@ void Lightning::recreatePipelines() {
.setLayout(boltPipelineLayout)
.setRenderPass(vkCtx->getImGuiRenderPass())
.setDynamicStates(dynamicStates)
.build(device);
.build(device, vkCtx->getPipelineCache());
vertModule.destroy();
fragModule.destroy();
@ -344,7 +344,7 @@ void Lightning::recreatePipelines() {
.setLayout(flashPipelineLayout)
.setRenderPass(vkCtx->getImGuiRenderPass())
.setDynamicStates(dynamicStates)
.build(device);
.build(device, vkCtx->getPipelineCache());
vertModule.destroy();
fragModule.destroy();