6243: Followup fixes for physical devices r=def- a=Jupeyy

<!-- What is the motivation for the changes of this pull request? -->

<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2023-01-06 22:34:41 +00:00 committed by GitHub
commit 1c43a7e9dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -50,6 +50,7 @@ enum EGFXWarningType
{ {
GFX_WARNING_TYPE_NONE = 0, GFX_WARNING_TYPE_NONE = 0,
GFX_WARNING_TYPE_INIT_FAILED, GFX_WARNING_TYPE_INIT_FAILED,
GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER,
GFX_WARNING_LOW_ON_MEMORY, GFX_WARNING_LOW_ON_MEMORY,
GFX_WARNING_MISSING_EXTENSION, GFX_WARNING_MISSING_EXTENSION,
GFX_WARNING_TYPE_UNKNOWN, GFX_WARNING_TYPE_UNKNOWN,

View file

@ -1210,7 +1210,7 @@ protected:
m_RecreateSwapChain = true; m_RecreateSwapChain = true;
break; break;
default: default:
m_ErrorHelper = "unknown error"; m_ErrorHelper = "unknown error: ";
m_ErrorHelper.append(std::to_string(CallResult)); m_ErrorHelper.append(std::to_string(CallResult));
pCriticalError = m_ErrorHelper.c_str(); pCriticalError = m_ErrorHelper.c_str();
break; break;
@ -3720,11 +3720,20 @@ public:
std::vector<VkPhysicalDevice> vDeviceList(DevicesCount); std::vector<VkPhysicalDevice> vDeviceList(DevicesCount);
Res = vkEnumeratePhysicalDevices(m_VKInstance, &DevicesCount, vDeviceList.data()); 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)); SetError(EGFXErrorType::GFX_ERROR_TYPE_INIT, CheckVulkanCriticalError(Res));
return false; return false;
} }
if(DevicesCount == 0)
{
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
// 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; size_t Index = 0;
std::vector<VkPhysicalDeviceProperties> vDevicePropList(vDeviceList.size()); std::vector<VkPhysicalDeviceProperties> vDevicePropList(vDeviceList.size());

View file

@ -311,6 +311,9 @@ void CCommandProcessor_SDL_GL::HandleWarning()
case GFX_WARNING_TYPE_INIT_FAILED: 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")); Warn.m_vWarnings.emplace_back(Localizable("Could not initialize the given graphics backend, reverting to the default backend now.", "Graphics error"));
break; 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: case GFX_WARNING_MISSING_EXTENSION:
// ignore this warning for now // ignore this warning for now
return; return;