Bad resize logic

This commit is contained in:
2025-11-29 13:03:17 +01:00
parent 493937f870
commit 9d807f926b
2 changed files with 28 additions and 4 deletions

View File

@@ -310,17 +310,23 @@ pub fn present(self: *Swapchain, engine: *Engine, present_info: PresentInfo) !Pr
// --- PRESENT CURRENT FRAME -----------------------------------------------
_ = try device.queuePresentKHR(mode.presentation_queue.handle, &.{
_ = device.queuePresentKHR(mode.presentation_queue.handle, &.{
.wait_semaphore_count = 1,
.p_wait_semaphores = @ptrCast(&current_swapchain_image.semaphore_render_finished),
.swapchain_count = 1,
.p_swapchains = @ptrCast(&self.swapchain),
.p_image_indices = @ptrCast(&self.image_index),
});
}) catch |err| switch (err) {
error.OutOfDateKHR => return .suboptimal,
else => return err,
};
// --- ACQUIRE NEXT FRAME --------------------------------------------------
const res = try device.acquireNextImageKHR(self.swapchain, std.math.maxInt(u64), self.semaphore_image_acquired, .null_handle);
const res = device.acquireNextImageKHR(self.swapchain, std.math.maxInt(u64), self.semaphore_image_acquired, .null_handle) catch |err| switch (err) {
error.OutOfDateKHR => return .suboptimal,
else => return err,
};
std.mem.swap(vk.Semaphore, &self.swapchain_images[res.image_index].semaphore_image_acquired, &self.semaphore_image_acquired);
self.image_index = res.image_index;