[perf][LOW] Invariant Vulkan structs rebuilt every frame #43
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Graphics#43
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: Window / swapchain / frame loop
Location:
implementations/Crafter.Graphics-Window.cpp:688-694, 696-724, 789-817Impact: LOW · Effort: Small
Problem
cmdBufInfo, the subresourcerange, bothVkImageMemoryBarrierstructs, andpresentInfoare reconstructed on the stack every frame though onlybarrier.image/oldLayoutandbarrier2.imagevary. The per-framerenderComplete != VK_NULL_HANDLEcheck (813-817) is dead — set once, never cleared.Proposed fix
Hoist invariants to members initialized in the constructor (
presentInfo.pImageIndices = ¤tBufferauto-tracks); per frame patch onlybarrier.image/oldLayout. Drop the dead null check.Note
VkSubmitInfois already a member, initialized once — only the begin-info, range, two barriers, and present-info apply. Single-digit-ns win; dwarfed by the wait-idle and per-pass barriers.