Fix crash related to failure to acquire next swapchain image during resizing

This commit is contained in:
Sebastian Emanuel Dawid
2025-05-13 11:27:22 +02:00
parent fdbe6d60d1
commit dfc5a3db4e

View File

@@ -80,7 +80,11 @@ pub const Swapchain = struct {
errdefer gc.dev.destroySemaphore(next_image_acquired, null); errdefer gc.dev.destroySemaphore(next_image_acquired, null);
const result = try gc.dev.acquireNextImageKHR(handle, std.math.maxInt(u64), next_image_acquired, .null_handle); const result = try gc.dev.acquireNextImageKHR(handle, std.math.maxInt(u64), next_image_acquired, .null_handle);
if (result.result != .success) { // event with a .suboptimal_khr we can still go on to present
// if we error even for .suboptimal_khr the example will crash and segfault
// on resize, since even the recreated swapchain can be suboptimal during a
// resize.
if (result.result == .not_ready or result.result == .timeout) {
return error.ImageAcquireFailed; return error.ImageAcquireFailed;
} }