perf(ui): flush only the written descriptor range, not the whole heap (#61)
WriteBufferDescriptor / WriteSampledImageDescriptor / RegisterSampler / WriteSwapchainDescriptors each FlushDevice()'d the entire multi-KB per-frame descriptor heap after writing one few-byte descriptor. Add a ranged VulkanBuffer::FlushDevice(offset, bytes) that flushes only the touched bytes, rounding the range outward to nonCoherentAtomSize as vkFlushMappedMemoryRanges requires (the WHOLE_SIZE path sidestepped that). The coherent-memory gate from issue #60 is preserved — coherent memory still skips the flush entirely. The descriptor writers now self-flush their written range, so the redundant whole-heap flushes in UIRenderer::Initialize and the resize callback are gone. Rounding lives in AlignMappedFlushRange (pure math) and is unit-tested without a device in the new VulkanBufferRangedFlush test; the change was also verified end-to-end by running HelloUI on a real GPU with validation layers (font-atlas glyphs, sampler and storage-image descriptors all flush correctly, no VUIDs). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ab222ffa1f
commit
6d7ad87e38
6 changed files with 236 additions and 7 deletions
|
|
@ -604,6 +604,10 @@ void Device::Initialize() {
|
|||
};
|
||||
vkGetPhysicalDeviceProperties2(physDevice, &properties2);
|
||||
|
||||
// Cache the flush/invalidate alignment for ranged host-memory flushes
|
||||
// (VulkanBuffer::FlushDevice(offset,bytes)).
|
||||
nonCoherentAtomSize = properties2.properties.limits.nonCoherentAtomSize;
|
||||
|
||||
// NVIDIA's brand-new VK_EXT_descriptor_heap acceleration-structure read
|
||||
// path faults (see #7); enable the SPIR-V rewrite workaround there. Other
|
||||
// drivers (and any future fixed NVIDIA driver, once this gate is removed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue