Vulkan: try fixing #456

This commit is contained in:
李通洲
2023-05-16 20:52:14 +08:00
parent e837e1e1d1
commit 424ca923fc
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -37,6 +37,7 @@ typedef struct FFGPUResult
int coreCount;
FFGPUMemory dedicated;
FFGPUMemory shared;
uint32_t vulkanDeviceId; // Only used for vulkan
} FFGPUResult;
const FFlist* ffDetectGPU(const FFinstance* instance);
+12
View File
@@ -176,8 +176,17 @@ static const char* detectVulkan(const FFinstance* instance, FFVulkanResult* resu
if(physicalDeviceProperties.properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)
continue;
// #456
FF_LIST_FOR_EACH(FFGPUResult, gpu, result->gpus)
{
if (gpu->vulkanDeviceId == physicalDeviceProperties.properties.deviceID)
goto next;
}
FFGPUResult* gpu = ffListAdd(&result->gpus);
gpu->vulkanDeviceId = physicalDeviceProperties.properties.deviceID;
ffStrbufInit(&gpu->name);
ffStrbufAppendS(&gpu->name, physicalDeviceProperties.properties.deviceName);
@@ -215,6 +224,9 @@ static const char* detectVulkan(const FFinstance* instance, FFVulkanResult* resu
//No way to detect those using vulkan
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
gpu->temperature = FF_GPU_TEMP_UNSET;
next:
continue;
}
//If the highest device version is lower than the instance version, use it as our vulkan version