perf(pipeline): shared, disk-persisted VkPipelineCache (#69) #97
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics!97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-69"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
vkCreateComputePipelinesandvkCreateRayTracingPipelinesKHRwere both passedVK_NULL_HANDLEfor theirVkPipelineCache, so the driver couldn't reuse compiled shader binaries — neither across the several pipelines built at startup (4 UI compute shaders + user/RT pipelines) nor across runs. One-time cold-start cost, not a per-frame one (issue #69).Changes
Device::pipelineCache, fed to both pipeline-creation sites. A null handle stays valid ("no cache"), so the create sites need no null check.Device::LoadPipelineCache(called once fromInitialize) seeds the cache frompipeline_cache.binwhen the file'sVkPipelineCacheHeaderVersionOneheader matches this device'svendorID/deviceID/pipelineCacheUUID. A stale or foreign blob (different GPU, driver update, corruption) is discarded so the driver never ignores or rejects it — worst case is a one-time cold compile.Device::SavePipelineCacheis registered withstd::atexit, serialising the driver's current cache blob at process shutdown without needing an explicit teardown hook (there is none today). The device handle is a never-destroyed static, so it's still valid in the handler; the save is best-effort and never throws.Device::devicePropertiesis now captured from theVkPhysicalDeviceProperties2query for the identity check.Testing
crafter-build test— 14 passed (--jobs=1; the default parallel run hit an unrelated crafter-build infra race where 13 concurrent test buildsgit pullthe shared Vulkan-Headers cache dir simultaneously and corrupt itsFETCH_HEAD).PipelineCacheValidationtest drivesDevice::PipelineCacheDataCompatibledirectly (no GPU), mirroringMemoryTypeFallback/UploadStrategy: a matching header is accepted; foreign vendor/device, a bumped UUID, unknown version, undersizedheaderSize, and short/empty blobs are all rejected.FrameLoopSyncdevice test, which now drops apipeline_cache.binat exit (gitignored).Resolves #69
🤖 Generated with Claude Code