2828static inline void chk (VkResult result) {
2929 if (result != VK_SUCCESS) {
3030 std::cerr << " Vulkan call returned an error (" << result << " )\n " ;
31- exit (result);
31+ if (result < VK_SUCCESS){
32+ exit (result);
33+ }
3234 }
3335}
3436static inline void chk (bool result) {
@@ -429,7 +431,7 @@ int main()
429431 // Sync
430432 chk (vkWaitForFences (device, 1 , &fences[frameIndex], true , UINT64_MAX));
431433 chk (vkResetFences (device, 1 , &fences[frameIndex]));
432- vkAcquireNextImageKHR (device, swapchain, UINT64_MAX, presentSemaphores[frameIndex], VK_NULL_HANDLE, &imageIndex);
434+ chk ( vkAcquireNextImageKHR (device, swapchain, UINT64_MAX, presentSemaphores[frameIndex], VK_NULL_HANDLE, &imageIndex) );
433435 // Update shader data
434436 shaderData.projection = glm::perspective (glm::radians (45 .0f ), (float )window.getSize ().x / (float )window.getSize ().y , 0 .1f , 32 .0f );
435437 shaderData.view = glm::translate (glm::mat4 (1 .0f ), camPos);
@@ -627,4 +629,4 @@ int main()
627629 vmaDestroyAllocator (allocator);
628630 vkDestroyDevice (device, nullptr );
629631 vkDestroyInstance (instance, nullptr );
630- }
632+ }
0 commit comments