[perf][LOW] Resize path: dead present-mode queries + presentModes vector #45

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

Subsystem: Window / swapchain / frame loop (resize path)
Location: implementations/Crafter.Graphics-Window.cpp:458, 820-829, 897-903
Impact: LOW · Effort: Small · Not hot path (transient drag-resize only)

Problem

During an interactive Wayland drag-resize, every configure fires Resize() -> vkQueueWaitIdle + CreateSwapchain, which re-queries present modes (vkGetPhysicalDeviceSurfacePresentModesKHR twice) and heap-allocates per call.

Proposed fix

The presentModes vector is dead codeswapchainPresentMode is unconditionally VK_PRESENT_MODE_FIFO_KHR. Delete both queries and the vector outright. Select compositeAlpha once at construction. Optionally coalesce rapid configures (the real drag-hitch win, but harder).

Correctness caveat

Keep the vkQueueWaitIdle (required before swapchain recreation). The dominant per-configure cost is the wait-idle + swapchain recreate, which these fixes do not touch.

**Subsystem:** Window / swapchain / frame loop (resize path) **Location:** `implementations/Crafter.Graphics-Window.cpp:458, 820-829, 897-903` **Impact:** LOW · **Effort:** Small · **Not hot path** (transient drag-resize only) ### Problem During an interactive Wayland drag-resize, every configure fires `Resize()` -> `vkQueueWaitIdle` + `CreateSwapchain`, which re-queries present modes (`vkGetPhysicalDeviceSurfacePresentModesKHR` twice) and heap-allocates per call. ### Proposed fix The `presentModes` vector is **dead code** — `swapchainPresentMode` is unconditionally `VK_PRESENT_MODE_FIFO_KHR`. Delete both queries and the vector outright. Select `compositeAlpha` once at construction. Optionally coalesce rapid configures (the real drag-hitch win, but harder). ### Correctness caveat Keep the `vkQueueWaitIdle` (required before swapchain recreation). The dominant per-configure cost is the wait-idle + swapchain recreate, which these fixes do not touch.
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#45
No description provided.