summaryrefslogtreecommitdiffstats
path: root/drivers/vulkan
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2023-02-26 20:07:18 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2023-08-17 14:48:36 +0200
commitce57c2379c16142b2ee910071f96476105afb684 (patch)
tree66048384750a91b875dd58ccca5ffa630446a3d9 /drivers/vulkan
parent281b7b9fdf033f391e6a2c2b1d777e61737ccb16 (diff)
downloadredot-engine-ce57c2379c16142b2ee910071f96476105afb684.tar.gz
Abort on startup with a visible alert if required Vulkan features are missing
Diffstat (limited to 'drivers/vulkan')
-rw-r--r--drivers/vulkan/vulkan_context.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index c1632907eb..b55eb586de 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -1339,9 +1339,26 @@ Error VulkanContext::_create_physical_device(VkSurfaceKHR p_surface) {
// features based on this query
vkGetPhysicalDeviceFeatures(gpu, &physical_device_features);
- // Check required features
- ERR_FAIL_COND_V_MSG(!physical_device_features.imageCubeArray, ERR_CANT_CREATE, "Your GPU doesn't support image cube arrays which are required to use the Vulkan-based renderers in Godot.");
- ERR_FAIL_COND_V_MSG(!physical_device_features.independentBlend, ERR_CANT_CREATE, "Your GPU doesn't support independentBlend which is required to use the Vulkan-based renderers in Godot.");
+ // Check required features and abort if any of them is missing.
+ if (!physical_device_features.imageCubeArray || !physical_device_features.independentBlend) {
+ String error_string = vformat("Your GPU (%s) does not support the following features which are required to use Vulkan-based renderers in Godot:\n\n", device_name);
+ if (!physical_device_features.imageCubeArray) {
+ error_string += "- No support for image cube arrays.\n";
+ }
+ if (!physical_device_features.independentBlend) {
+ error_string += "- No support for independentBlend.\n";
+ }
+ error_string += "\nThis is usually a hardware limitation, so updating graphics drivers won't help in most cases.";
+
+#if defined(ANDROID_ENABLED) || defined(IOS_ENABLED)
+ // Android/iOS platform ports currently don't exit themselves when this method returns `ERR_CANT_CREATE`.
+ OS::get_singleton()->alert(error_string + "\nClick OK to exit (black screen will be visible).");
+#else
+ OS::get_singleton()->alert(error_string + "\nClick OK to exit.");
+#endif
+
+ return ERR_CANT_CREATE;
+ }
physical_device_features.robustBufferAccess = false; // Turn off robust buffer access, which can hamper performance on some hardware.