Check API version before adding GPU to GPU list

Signed-off-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
Jupeyy 2024-07-21 13:15:42 +02:00
parent cb9521d29f
commit e96275943b
No known key found for this signature in database

View file

@ -3744,17 +3744,17 @@ public:
STWGraphicGpu::ETWGraphicsGpuType GPUType = VKGPUTypeToGraphicsGpuType(DeviceProp.deviceType); STWGraphicGpu::ETWGraphicsGpuType GPUType = VKGPUTypeToGraphicsGpuType(DeviceProp.deviceType);
int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion);
int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion);
if(DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor))
{
STWGraphicGpu::STWGraphicGpuItem NewGpu; STWGraphicGpu::STWGraphicGpuItem NewGpu;
str_copy(NewGpu.m_aName, DeviceProp.deviceName); str_copy(NewGpu.m_aName, DeviceProp.deviceName);
NewGpu.m_GpuType = GPUType; NewGpu.m_GpuType = GPUType;
m_pGpuList->m_vGpus.push_back(NewGpu); m_pGpuList->m_vGpus.push_back(NewGpu);
Index++; if(GPUType < AutoGpuType)
int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion);
int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion);
if(GPUType < AutoGpuType && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
{ {
str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName); str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName);
m_pGpuList->m_AutoGpu.m_GpuType = GPUType; m_pGpuList->m_AutoGpu.m_GpuType = GPUType;
@ -3768,12 +3768,17 @@ public:
FoundGpuType = GPUType; FoundGpuType = GPUType;
} }
} }
Index++;
}
if(FoundDeviceIndex == 0) if(m_pGpuList->m_vGpus.empty())
FoundDeviceIndex = 1; {
SetWarning(EGfxWarningType::GFX_WARNING_TYPE_INIT_FAILED_MISSING_INTEGRATED_GPU_DRIVER, "No devices with required vulkan version found.");
return false;
}
{ {
auto &DeviceProp = vDevicePropList[FoundDeviceIndex - 1]; auto &DeviceProp = vDevicePropList[FoundDeviceIndex];
int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion); int DevAPIMajor = (int)VK_API_VERSION_MAJOR(DeviceProp.apiVersion);
int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion); int DevAPIMinor = (int)VK_API_VERSION_MINOR(DeviceProp.apiVersion);
@ -3833,7 +3838,7 @@ public:
} }
} }
VkPhysicalDevice CurDevice = vDeviceList[FoundDeviceIndex - 1]; VkPhysicalDevice CurDevice = vDeviceList[FoundDeviceIndex];
uint32_t FamQueueCount = 0; uint32_t FamQueueCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(CurDevice, &FamQueueCount, nullptr); vkGetPhysicalDeviceQueueFamilyProperties(CurDevice, &FamQueueCount, nullptr);