perf(decompress): release compressed staging after submit, not for the resource's life
The compressed Mesh::Build / ImageVulkan::Update paths kept their host-visible `compressedStaging` (holding the GDeflate streams) alive for the whole life of the mesh/image, pinning host-visible memory long after the single GPU decompress that reads it has retired. Release it via VulkanBuffer::DeferredClear() right after recording the decompress. The recorded vkCmdDecompressMemoryEXT still references compressedStaging.address, so it must outlive the submit — exactly what the fence-keyed deletion queue (#101/#102) guarantees: it retires the allocation only after framesInFlight frames have elapsed, by which point the submit's fence has cleared. Between Builds/Updates the handle is null; the next call's Resize re-creates it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3e0a38fafb
commit
8a32f0d545
3 changed files with 33 additions and 9 deletions
|
|
@ -261,6 +261,16 @@ void Mesh::Build(const CompressedMeshAsset& asset, VkCommandBuffer cmd, RTBuildO
|
|||
VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR,
|
||||
VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR);
|
||||
|
||||
// The compressed staging is only read by the decompress recorded above; the
|
||||
// subsequent BLAS build reads the decompressed vertex/index buffers, never
|
||||
// this. So hand it to the fence-keyed deletion queue (#101/#102) now rather
|
||||
// than pinning host-visible memory for the mesh's whole life. The recorded
|
||||
// vkCmdDecompressMemoryEXT still references compressedStaging.address, so it
|
||||
// must outlive this submit — which the queue guarantees: it retires the
|
||||
// allocation only after framesInFlight frames have elapsed, by which point
|
||||
// the decompress submit's fence has cleared.
|
||||
compressedStaging.DeferredClear();
|
||||
|
||||
allowUpdate = options.allowUpdate;
|
||||
builtInputCount = asset.vertexCount;
|
||||
RecordBLASBuild(*this, asset.vertexCount, asset.indexCount, BlasFlags(options), /*update*/ false, cmd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue