[perf][LOW] FlushDevice always flushes even on coherent memory #60
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#60
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Subsystem: VulkanBuffer
Location:
interfaces/Crafter.Graphics-VulkanBuffer.cppm:160-168, 194-202Impact: LOW · Effort: Small · Not hot path (genuine per-frame Vulkan caller is HOST_COHERENT already)
Problem
FlushDevice/FlushHostunconditionally callvkFlushMappedMemoryRanges/Invalidatewith no record of whether the memory type is coherent.Proposed fix
Record the actual chosen memory type's
propertyFlagsat Create time and early-return when HOST_COHERENT.Correctness caveat (trap)
Gate on the chosen type's flags via
memoryProperties.memoryTypes[idx].propertyFlags— not the requested flags. The heaps requestHOST_VISIBLE|DEVICE_LOCAL(no COHERENT bit) yet may land on a coherent type; conversely a non-coherent type requires the flush. Never remove the barrier in thecmdoverload. (Per-frame "hot" examples from the original finding were WebGPU, not this path.)