perf(window): use HOST_CACHED readback staging in SaveFrame (#74) #108
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!108
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-74"
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
SaveFrameallocated its readback staging bufferHOST_VISIBLE | HOST_COHERENT. On most discrete GPUs the first such type is write-combined (uncached), and CPU reads from write-combined memory are pathologically slow — the wrong memory type for a path that reads the whole frame back to disk.Fix
HOST_CACHEDtype (preferring a cached-coherent type when one exists), falling back to anyHOST_VISIBLEtype if no cached type is advertised (#59 mechanism, viaGetMemoryType's required/preferred passes + a catch).FlushDevice(#60). Gated on the chosen type's actual coherency, not the requested flags. Whole-range invalidate sidestepsnonCoherentAtomSize.DEVICE_LOCAL|HOST_VISIBLE— the worst type for readback (see issue caveat 4).Testing
crafter-build test— all 19 tests pass (incl.MemoryTypeFallback, which covers the fallback mechanism relied on here).SaveFramefrom the VulkanTriangle example on an RTX 4090; the frame reads back with correct pixels and channel order.Screenshots
Resolves #74