perf(window): drop dead present-mode queries from swapchain recreate (#45) #79

Merged
catbot merged 1 commit from claude/issue-45 into master 2026-06-16 17:29:00 +02:00
Member

Summary

Removes dead code from the swapchain recreation path that runs on every Wayland drag-resize configure.

  • CreateSwapchain unconditionally selected VK_PRESENT_MODE_FIFO_KHR, yet still issued two vkGetPhysicalDeviceSurfacePresentModesKHR calls and heap-allocated a std::vector<VkPresentModeKHR> to enumerate modes that were never consulted. Deleted both queries, the vector, and the assert; the present mode is now assigned directly.
  • compositeAlpha is a surface property that does not change across swapchain recreation, so it is now selected once at construction (and cached on the Window) instead of being re-derived — with another heap-allocated vector — on every resize configure.

Correctness

  • The vkQueueWaitIdle(Device::queue) before swapchain recreation is left intact (required before recreation).
  • compositeAlpha selection logic uses the same priority list, just hoisted to construction where vulkanSurface already exists.
  • Behaviour is unchanged; FIFO is guaranteed available per the Vulkan spec.

Testing

crafter-build test — 3 passed (MouseScroll, BLASBuildOptions, PushConstantRewrite). Crafter.Graphics-Window.cpp compiles clean.

Resolves #45

## Summary Removes dead code from the swapchain recreation path that runs on every Wayland drag-resize configure. - `CreateSwapchain` unconditionally selected `VK_PRESENT_MODE_FIFO_KHR`, yet still issued **two** `vkGetPhysicalDeviceSurfacePresentModesKHR` calls and heap-allocated a `std::vector<VkPresentModeKHR>` to enumerate modes that were never consulted. Deleted both queries, the vector, and the `assert`; the present mode is now assigned directly. - `compositeAlpha` is a surface property that does not change across swapchain recreation, so it is now selected **once at construction** (and cached on the `Window`) instead of being re-derived — with another heap-allocated vector — on every resize configure. ## Correctness - The `vkQueueWaitIdle(Device::queue)` before swapchain recreation is left intact (required before recreation). - `compositeAlpha` selection logic uses the same priority list, just hoisted to construction where `vulkanSurface` already exists. - Behaviour is unchanged; FIFO is guaranteed available per the Vulkan spec. ## Testing `crafter-build test` — 3 passed (MouseScroll, BLASBuildOptions, PushConstantRewrite). `Crafter.Graphics-Window.cpp` compiles clean. Resolves #45
CreateSwapchain unconditionally used VK_PRESENT_MODE_FIFO_KHR, but still
ran two vkGetPhysicalDeviceSurfacePresentModesKHR calls plus a heap-allocated
std::vector to enumerate present modes that were never consulted. Delete
them and assign the constant directly.

compositeAlpha is a surface property that does not change across swapchain
recreation, so select it once at construction instead of re-deriving it
(with another heap-allocated vector) on every resize configure. The
vkQueueWaitIdle before recreation is left intact as required.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
catbot merged commit 459f10afa8 into master 2026-06-16 17:29:00 +02:00
catbot deleted branch claude/issue-45 2026-06-16 17:29:00 +02:00
Sign in to join this conversation.
No reviewers
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!79
No description provided.