From 334b0fe757cd7aaec9cd8767a508bf007f8d8a3d Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Fri, 6 Jan 2023 19:51:16 +0100 Subject: [PATCH 1/2] Followup fixes for physical devices --- src/engine/client/backend/vulkan/backend_vulkan.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/engine/client/backend/vulkan/backend_vulkan.cpp b/src/engine/client/backend/vulkan/backend_vulkan.cpp index b8e571cf5..e8e34d6ef 100644 --- a/src/engine/client/backend/vulkan/backend_vulkan.cpp +++ b/src/engine/client/backend/vulkan/backend_vulkan.cpp @@ -1210,7 +1210,7 @@ protected: m_RecreateSwapChain = true; break; default: - m_ErrorHelper = "unknown error"; + m_ErrorHelper = "unknown error: "; m_ErrorHelper.append(std::to_string(CallResult)); pCriticalError = m_ErrorHelper.c_str(); break; @@ -3720,11 +3720,20 @@ public: std::vector vDeviceList(DevicesCount); Res = vkEnumeratePhysicalDevices(m_VKInstance, &DevicesCount, vDeviceList.data()); - if(Res != VK_SUCCESS) + if(Res != VK_SUCCESS && Res != VK_INCOMPLETE) { SetError(EGFXErrorType::GFX_ERROR_TYPE_INIT, CheckVulkanCriticalError(Res)); return false; } + if(DevicesCount == 0) + { + SetError(EGFXErrorType::GFX_ERROR_TYPE_INIT, "No vulkan compatible devices found."); + return false; + } + // make sure to use the correct amount of devices available + // the amount of physical devices can be smaller than the amount of devices reported + // see vkEnumeratePhysicalDevices for details + vDeviceList.resize(DevicesCount); size_t Index = 0; std::vector vDevicePropList(vDeviceList.size()); From 9cf82dfcbc11039e3728d9ee49b1821a826c5178 Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Fri, 6 Jan 2023 20:23:43 +0100 Subject: [PATCH 2/2] Add warning for missing integrated CPU driver --- src/engine/client/backend/backend_base.h | 1 + src/engine/client/backend/vulkan/backend_vulkan.cpp | 2 +- src/engine/client/backend_sdl.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/client/backend/backend_base.h b/src/engine/client/backend/backend_base.h index d38f4fb1e..5d389ac76 100644 --- a/src/engine/client/backend/backend_base.h +++ b/src/engine/client/backend/backend_base.h @@ -50,6 +50,7 @@ enum EGFXWarningType { GFX_WARNING_TYPE_NONE = 0, GFX_WARNING_TYPE_INIT_FAILED, + GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER, GFX_WARNING_LOW_ON_MEMORY, GFX_WARNING_MISSING_EXTENSION, GFX_WARNING_TYPE_UNKNOWN, diff --git a/src/engine/client/backend/vulkan/backend_vulkan.cpp b/src/engine/client/backend/vulkan/backend_vulkan.cpp index e8e34d6ef..9acfb44d6 100644 --- a/src/engine/client/backend/vulkan/backend_vulkan.cpp +++ b/src/engine/client/backend/vulkan/backend_vulkan.cpp @@ -3727,7 +3727,7 @@ public: } if(DevicesCount == 0) { - SetError(EGFXErrorType::GFX_ERROR_TYPE_INIT, "No vulkan compatible devices found."); + SetWarning(EGFXWarningType::GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER, "No vulkan compatible devices found."); return false; } // make sure to use the correct amount of devices available diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 152cc8f69..2f6bc4d3a 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -311,6 +311,9 @@ void CCommandProcessor_SDL_GL::HandleWarning() case GFX_WARNING_TYPE_INIT_FAILED: Warn.m_vWarnings.emplace_back(Localizable("Could not initialize the given graphics backend, reverting to the default backend now.", "Graphics error")); break; + case GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER: + Warn.m_vWarnings.emplace_back(Localizable("Could not initialize the given graphics backend, this is probably caused because you didn't install the driver of the integrated graphics card.", "Graphics error")); + break; case GFX_WARNING_MISSING_EXTENSION: // ignore this warning for now return;