vulkan-guide icon indicating copy to clipboard operation
vulkan-guide copied to clipboard

Chapter 1 VK_CHECK seems to fail when acquiring the first swapchain image for a second time.

Open XavierCS-dev opened this issue 1 year ago • 4 comments

When attemping to acquiring the image of index 0 a second time, VK_CHECK fails and aborts. Output of swapchainImageIndex without VK_CHECK before crash

0
1
2
3
0

With VK_CHECK

0
1
2
3

Program error message:

Aborted (core dumped)

XavierCS-dev avatar May 01 '24 19:05 XavierCS-dev

When pausing the thread just before it crashes, it seems the screen is also black, instead of the blue it is meant to be. There are no validation errors.

XavierCS-dev avatar May 01 '24 20:05 XavierCS-dev

The VK_CHECK macro was not printing any error codes so I printed them myself, and it seems that it is caused by VK_SUBOPTIMAL_KHR. Adding fflush() to VK_CHECK(x) fixes the problem with the macro. I am not resizing the window, I checked SDL for the event and no resizing was occurring.

XavierCS-dev avatar May 02 '24 06:05 XavierCS-dev

Calling

destroy_swapchain();
init_swapchain();
init_sync_structures();

Seems to fix the issue.

XavierCS-dev avatar May 02 '24 07:05 XavierCS-dev

I started recreating the swapchain instead of just using VK_CHECK which crashes the program. I think VK_CHECK(x) should just disable any vulkan errors instead of aborting.

XavierCS-dev avatar May 02 '24 08:05 XavierCS-dev