Skip to content

Commit

Permalink
Check API version before adding GPU to GPU list
Browse files Browse the repository at this point in the history
Signed-off-by: Jupeyy <[email protected]>
  • Loading branch information
Jupeyy committed Jul 21, 2024
1 parent cb9521d commit 12604ec
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions src/engine/client/backend/vulkan/backend_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3744,29 +3744,37 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase

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(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;
}

if(FoundDeviceIndex == 0)
Expand Down

0 comments on commit 12604ec

Please sign in to comment.