summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:41 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:41 -0600
commitbbde4ed32462269a757ad442329e3cefa7f47ccb (patch)
treefbb9e06aad3bd6659843690a3cb49e53aaa352a6 /drivers
parent33ad26dad52d631b5df2a9efc25a744ecf344643 (diff)
parentddf5c03f4bbb6f6a8000860ada197cec096b42d4 (diff)
downloadredot-engine-bbde4ed32462269a757ad442329e3cefa7f47ccb.tar.gz
Merge pull request #98883 from ducklin5/fix/VkResultError
Add vulkan error checks in command_queue_execute_and_present
Diffstat (limited to 'drivers')
-rw-r--r--drivers/vulkan/rendering_device_driver_vulkan.cpp22
-rw-r--r--drivers/vulkan/rendering_device_driver_vulkan.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp
index f50771ddde..6eecd850f5 100644
--- a/drivers/vulkan/rendering_device_driver_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp
@@ -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;
@@ -5434,6 +5437,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 ****/
/********************/
diff --git a/drivers/vulkan/rendering_device_driver_vulkan.h b/drivers/vulkan/rendering_device_driver_vulkan.h
index 6931015a22..06cd2a31be 100644
--- a/drivers/vulkan/rendering_device_driver_vulkan.h
+++ b/drivers/vulkan/rendering_device_driver_vulkan.h
@@ -655,6 +655,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 ****/