[perf][LOW] Descriptor-heap bind recorded unconditionally every frame #42

Closed
opened 2026-06-16 16:51:30 +02:00 by jorijnvdgraaf · 0 comments

Subsystem: Window / swapchain / frame loop
Location: implementations/Crafter.Graphics-Window.cpp:736-758
Impact: LOW · Effort: Small

Problem

Every frame rebuilds two VkBindHeapInfoEXT structs and recomputes reservedRangeOffset via a runtime subtract + bitmask against Device::descriptorHeapProperties. The heap address/size per slot are stable; only currentBuffer varies.

Proposed fix

Precompute numFrames VkBindHeapInfoEXT structs when the heap is assigned / swapchain recreated, and record the cached struct for currentBuffer.

Correctness caveat

Invalidate the cache from the descriptorHeap setter (the safest hook), not onResize. The heaps never resize today, so this is correct.

**Subsystem:** Window / swapchain / frame loop **Location:** `implementations/Crafter.Graphics-Window.cpp:736-758` **Impact:** LOW · **Effort:** Small ### Problem Every frame rebuilds two `VkBindHeapInfoEXT` structs and recomputes `reservedRangeOffset` via a runtime subtract + bitmask against `Device::descriptorHeapProperties`. The heap address/size per slot are stable; only `currentBuffer` varies. ### Proposed fix Precompute `numFrames` `VkBindHeapInfoEXT` structs when the heap is assigned / swapchain recreated, and record the cached struct for `currentBuffer`. ### Correctness caveat Invalidate the cache from the `descriptorHeap` **setter** (the safest hook), not `onResize`. The heaps never resize today, so this is correct.
catbot 2026-06-16 17:27:55 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Catcrafts/Crafter.Graphics#42
No description provided.