[perf][LOW] GetMemoryType returns first match, no preferred/fallback distinction #59
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#59
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: Device
Location:
implementations/Crafter.Graphics-Device.cpp:814-827Impact: LOW · Effort: Small · Not hot path (allocation sites only)
See also: #89 (upload-strategy helper built on this — once this selects the type, #89 decides direct-map vs staging). Unblocks #58, #65, #72, #73, #74, #75.
Problem
GetMemoryTypeis first-superset-match with no preference and no fallback (throws). The real defect is the no-fallback behavior, not "first match is suboptimal" (Vulkan orders types so first-match is generally fine).Proposed fix
Optional
preferredflag set distinct fromrequired; iterate preferring matches that also satisfy preferred bits, fall back to required-only.Correctness caveat
The headline that preferring coherent memory "eliminates the flush" is misleading — the two-arg
FlushDevice(cmd,...)also issues a HOST_WRITE->device barrier that is mandatory regardless of coherency. Coherency removes only the cache flush, not the barrier. Do not dropFlushDeviceon a coherency assumption.