mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Merge pull request #8628 from Jupeyy/pr_gpu_if
Check API version before adding GPU to GPU list
This commit is contained in:
commit
d8cee35f73
|
@ -3744,36 +3744,41 @@ public:
|
|||
|
||||
STWGraphicGpu::ETWGraphicsGpuType GPUType = VKGPUTypeToGraphicsGpuType(DeviceProp.deviceType);
|
||||
|
||||
STWGraphicGpu::STWGraphicGpuItem NewGpu;
|
||||
str_copy(NewGpu.m_aName, DeviceProp.deviceName);
|
||||
NewGpu.m_GpuType = GPUType;
|
||||
m_pGpuList->m_vGpus.push_back(NewGpu);
|
||||
|
||||
Index++;
|
||||
|
||||
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)))
|
||||
if(DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor))
|
||||
{
|
||||
str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName);
|
||||
m_pGpuList->m_AutoGpu.m_GpuType = GPUType;
|
||||
STWGraphicGpu::STWGraphicGpuItem NewGpu;
|
||||
str_copy(NewGpu.m_aName, DeviceProp.deviceName);
|
||||
NewGpu.m_GpuType = GPUType;
|
||||
m_pGpuList->m_vGpus.push_back(NewGpu);
|
||||
|
||||
AutoGpuType = GPUType;
|
||||
}
|
||||
if(GPUType < AutoGpuType)
|
||||
{
|
||||
str_copy(m_pGpuList->m_AutoGpu.m_aName, DeviceProp.deviceName);
|
||||
m_pGpuList->m_AutoGpu.m_GpuType = GPUType;
|
||||
|
||||
if(((IsAutoGpu && (FoundGpuType > STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INTEGRATED && GPUType < FoundGpuType)) || str_comp(DeviceProp.deviceName, g_Config.m_GfxGpuName) == 0) && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
|
||||
{
|
||||
FoundDeviceIndex = Index;
|
||||
FoundGpuType = GPUType;
|
||||
AutoGpuType = GPUType;
|
||||
}
|
||||
|
||||
if(((IsAutoGpu && (FoundGpuType > STWGraphicGpu::ETWGraphicsGpuType::GRAPHICS_GPU_TYPE_INTEGRATED && GPUType < FoundGpuType)) || str_comp(DeviceProp.deviceName, g_Config.m_GfxGpuName) == 0) && (DevAPIMajor > gs_BackendVulkanMajor || (DevAPIMajor == gs_BackendVulkanMajor && DevAPIMinor >= gs_BackendVulkanMinor)))
|
||||
{
|
||||
FoundDeviceIndex = Index;
|
||||
FoundGpuType = GPUType;
|
||||
}
|
||||
}
|
||||
Index++;
|
||||
}
|
||||
|
||||
if(FoundDeviceIndex == 0)
|
||||
FoundDeviceIndex = 1;
|
||||
if(m_pGpuList->m_vGpus.empty())
|
||||
{
|
||||
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 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;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(CurDevice, &FamQueueCount, nullptr);
|
||||
|
|
Loading…
Reference in a new issue