perf(decompress): release compressed staging after submit, not for the resource's life (#67) #106
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!106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-67"
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?
Problem
compressedStaging— the host-visible buffer holding the GDeflate streams for the GPU decompress path — was kept alive per compressed Build/Update for the whole life of the mesh/image. The singlevkCmdDecompressMemoryEXTthat reads it retires almost immediately, but the staging stayed mapped and pinned host-visible memory forever afterward.implementations/Crafter.Graphics-Mesh.cpp(compressedMesh::Build)interfaces/Crafter.Graphics-ImageVulkan.cppm(compressedImageVulkan::Update)Fix
Release the staging via
VulkanBuffer::DeferredClear()immediately after recording the decompress (option (a) from the issue). The recordedvkCmdDecompressMemoryEXTstill referencescompressedStaging.address, so the buffer must outlive the submit — which is exactly the guarantee the fence-keyed deferred-deletion queue from #101/#102 provides: it retires the allocation only onceframesInFlightframes have elapsed, by which point the submit's fence has cleared. The subsequent BLAS build / buffer→image copy read the decompressed outputs, never the staging, so this is safe.Between Builds/Updates the handle is null; the next call's
Resizere-creates it.Testing
New
MeshDecompressStagingReleasetest drives the realVK_EXT_memory_decompression/ GDeflate path on a headless device and asserts:framesInFlightframes elapse, not before.Falls back to a graceful skip on hardware without the extension (the CPU-decode path never allocates the staging).
(
--jobs=1serializes the run to avoid a pre-existing parallelgit pullrace on the shared Vulkan-Headers external-dep cache — unrelated to this change.)Builds on #101 / #102.
Resolves #67
🤖 Generated with Claude Code