fix: add vulkan error checks in command_queue_execute_and_present

fix: add debug helper functoin and update messaging vulkan result
This commit is contained in:
Azeez Abass 2024-11-06 02:17:04 +00:00
parent 2ad452ad5b
commit ddf5c03f4b
2 changed files with 22 additions and 1 deletions

View File

@ -2611,7 +2611,10 @@ Error RenderingDeviceDriverVulkan::command_queue_execute_and_present(CommandQueu
// it'll lead to very low performance in Android by entering an endless loop where it'll always resize the swap chain
// every frame.
ERR_FAIL_COND_V(err != VK_SUCCESS && err != VK_SUBOPTIMAL_KHR, FAILED);
ERR_FAIL_COND_V_MSG(
err != VK_SUCCESS && err != VK_SUBOPTIMAL_KHR,
FAILED,
"QueuePresentKHR failed with error: " + get_vulkan_result(err));
}
return OK;
@ -5427,6 +5430,23 @@ void RenderingDeviceDriverVulkan::print_lost_device_info() {
on_device_lost();
}
inline String RenderingDeviceDriverVulkan::get_vulkan_result(VkResult err) {
#if defined(DEBUG_ENABLED) || defined(DEV_ENABLED)
if (err == VK_ERROR_OUT_OF_HOST_MEMORY) {
return "VK_ERROR_OUT_OF_HOST_MEMORY";
} else if (err == VK_ERROR_OUT_OF_DEVICE_MEMORY) {
return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
} else if (err == VK_ERROR_DEVICE_LOST) {
return "VK_ERROR_DEVICE_LOST";
} else if (err == VK_ERROR_SURFACE_LOST_KHR) {
return "VK_ERROR_SURFACE_LOST_KHR";
} else if (err == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT) {
return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT";
}
#endif
return itos(err);
}
/********************/
/**** SUBMISSION ****/
/********************/

View File

@ -656,6 +656,7 @@ public:
virtual void command_insert_breadcrumb(CommandBufferID p_cmd_buffer, uint32_t p_data) override final;
void print_lost_device_info();
void on_device_lost() const;
static String get_vulkan_result(VkResult err);
/********************/
/**** SUBMISSION ****/