perf(vulkan-buffer): skip flush/invalidate on coherent memory (#60) #94
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!94
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-60"
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
VulkanBuffer::FlushDevice/FlushHostcalledvkFlushMappedMemoryRanges/vkInvalidateMappedMemoryRangesunconditionally, with no record of whether the backing memory is coherent. On HOST_COHERENT memory those calls are pure overhead — host/device writes are mutually visible without an explicit flush.Fix
propertyFlagsatCreatetime, from the indexGetMemoryTypeactually returns (Device::memoryProperties.memoryTypes[idx].propertyFlags) — not the requested flags. A request lacking the COHERENT bit can still land on a coherent type, and a non-coherent type genuinely needs the flush.FlushDevice()/FlushHost()early-return when the chosen type isHOST_COHERENT.cmdoverload ofFlushDeviceis unchanged in its barrier behaviour — it still always emits its pipeline barrier; only the redundant host-side flush is gated.Tests
New
VulkanBufferFlushGateregression test (pure CPU, no GPU device): stampsmemoryPropertyFlagsChosenand verifies the coherent path issues no Vulkan call. Full suite green — 10 passed.Resolves #60