perf(pipeline): shared, disk-persisted VkPipelineCache (#69)
vkCreateComputePipelines and vkCreateRayTracingPipelinesKHR were passed VK_NULL_HANDLE, so the driver couldn't reuse compiled shader binaries across the pipelines built at startup (4 UI shaders + user/RT pipelines) or across runs. Add one process-wide Device::pipelineCache. LoadPipelineCache (called from Initialize) seeds it from pipeline_cache.bin when the file's VkPipelineCacheHeaderVersionOne header matches this device's vendorID / deviceID / pipelineCacheUUID; a stale or foreign blob is discarded so the driver never rejects it. SavePipelineCache is registered with std::atexit, serialising the cache at process shutdown without any explicit teardown hook. Both create sites now pass the cache; a null handle stays valid, so no create-site null check is needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ab222ffa1f
commit
a3a6dd2006
4 changed files with 144 additions and 4 deletions
|
|
@ -82,7 +82,7 @@ export namespace Crafter {
|
|||
.layout = VK_NULL_HANDLE
|
||||
};
|
||||
|
||||
Device::CheckVkResult(Device::vkCreateRayTracingPipelinesKHR(Device::device, {}, {}, 1, &rtPipelineInfo, nullptr, &pipeline));
|
||||
Device::CheckVkResult(Device::vkCreateRayTracingPipelinesKHR(Device::device, {}, Device::pipelineCache, 1, &rtPipelineInfo, nullptr, &pipeline));
|
||||
|
||||
std::size_t dataSize = Device::rayTracingProperties.shaderGroupHandleSize * rtPipelineInfo.groupCount;
|
||||
shaderHandles.resize(dataSize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue