perf(window): cache per-frame heap-bind structs across frames #77
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!77
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-42"
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
Every frame,
Window::Render()rebuilt twoVkBindHeapInfoEXTstructs and recomputedreservedRangeOffsetvia a runtime subtract + bitmask againstDevice::descriptorHeapProperties. The heap address/size per slot are stable for a given heap; onlycurrentBuffervaries.This precomputes
numFramesresource/sampler bind structs and caches them, recording the cached struct forcurrentBuffereach frame.Invalidation
The cache is keyed on the
descriptorHeappointer (cachedDescriptorHeap). It rebuilds whenever the heap is (re)assigned and otherwise just indexes bycurrentBuffer. SincedescriptorHeapis a public field assigned directly (window.descriptorHeap = &heap) with no setter to hook, pointer-keyed invalidation is the equivalent — and strictly safer — hook: it fires on any reassignment, exactly when a setter would, and is independent ofonResize(heaps never resize today, per the issue's correctness caveat).Testing
crafter-build test— green (3 passed).descriptorHeap, renders + presents). Vulkan validation layers reported no errors on the heap-bind path; the ray-traced triangle presents correctly.Screenshots
Resolves #42