Merge pull request #72858 from clayjohn/VK-swap-buffers-err

Add more debug information to swapchain errors in Vulkan context
This commit is contained in:
Rémi Verschelde 2023-02-08 09:34:13 +01:00
commit 1258de0d70
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2271,7 +2271,7 @@ Error VulkanContext::prepare_buffers() {
print_verbose("Vulkan: Early suboptimal swapchain.");
break;
} else if (err != VK_SUCCESS) {
ERR_BREAK_MSG(err != VK_SUCCESS, "Vulkan: Did not create swapchain successfully.");
ERR_BREAK_MSG(err != VK_SUCCESS, "Vulkan: Did not create swapchain successfully. Error code: " + String(string_VkResult(err)));
} else {
w->semaphore_acquired = true;
}
@ -2348,7 +2348,7 @@ Error VulkanContext::swap_buffers() {
submit_info.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = &draw_complete_semaphores[frame_index];
err = vkQueueSubmit(graphics_queue, 1, &submit_info, fences[frame_index]);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "Vulkan: Cannot submit graphics queue. Error code: " + String(string_VkResult(err)));
command_buffer_queue.write[0] = nullptr;
command_buffer_count = 1;
@ -2379,7 +2379,7 @@ Error VulkanContext::swap_buffers() {
submit_info.signalSemaphoreCount = 1;
submit_info.pSignalSemaphores = &image_ownership_semaphores[frame_index];
err = vkQueueSubmit(present_queue, 1, &submit_info, nullFence);
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "Vulkan: Cannot submit present queue. Error code: " + String(string_VkResult(err)));
}
// If we are using separate queues, we have to wait for image ownership,
@ -2488,14 +2488,14 @@ Error VulkanContext::swap_buffers() {
if (err == VK_ERROR_OUT_OF_DATE_KHR) {
// Swapchain is out of date (e.g. the window was resized) and
// must be recreated.
print_verbose("Vulkan: Swapchain is out of date, recreating.");
print_verbose("Vulkan queue submit: Swapchain is out of date, recreating.");
resize_notify();
} else if (err == VK_SUBOPTIMAL_KHR) {
// Swapchain is not as optimal as it could be, but the platform's
// presentation engine will still present the image correctly.
print_verbose("Vulkan: Swapchain is suboptimal.");
print_verbose("Vulkan queue submit: Swapchain is suboptimal.");
} else {
ERR_FAIL_COND_V(err, ERR_CANT_CREATE);
ERR_FAIL_COND_V_MSG(err, ERR_CANT_CREATE, "Error code: " + String(string_VkResult(err)));
}
buffers_prepared = false;