Добавил память и семейства очередей к выбору устройства

This commit is contained in:
parent 23b8cbd8b7
commit f44e838959
1 changed files with 16 additions and 4 deletions

View File

@ -121,16 +121,26 @@ void Vulkan::createInstance()
// Выбор физического устройства на основании требований // Выбор физического устройства на основании требований
VkPhysicalDevice selectPhysicalDeviceByProperties(std::vector<VkPhysicalDevice> & devices) VkPhysicalDevice selectPhysicalDeviceByProperties(std::vector<VkPhysicalDevice> & devices)
{ {
VkPhysicalDeviceProperties properties; // Параметры конкретного устройства int i;
VkPhysicalDeviceFeatures features; // Функции конкретного устройства VkPhysicalDeviceProperties properties; // Параметры конкретного устройства
VkPhysicalDeviceFeatures features; // Функции конкретного устройства
VkPhysicalDeviceMemoryProperties memory; // Память
for (const auto& device : devices) for (const auto& device : devices)
{ {
// Получаем данные // Получаем данные
vkGetPhysicalDeviceProperties(device, &properties); vkGetPhysicalDeviceProperties(device, &properties);
vkGetPhysicalDeviceFeatures(device, &features); vkGetPhysicalDeviceFeatures(device, &features);
vkGetPhysicalDeviceMemoryProperties(device, &memory);
// Данные по семействам очередей
uint32_t queueFamilyPropertiesCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyPropertiesCount, nullptr);
std::vector<VkQueueFamilyProperties> queueFamilyProperties(queueFamilyPropertiesCount);
vkGetPhysicalDeviceQueueFamilyProperties(device, &queueFamilyPropertiesCount, queueFamilyProperties.data());
// Производим оценку // Производим оценку
if (features.geometryShader) if (features.geometryShader
&& 4000 < memory.memoryHeaps[0].size / 1000 / 1000)
return device; return device;
} }
@ -162,4 +172,6 @@ void Vulkan::selectPhysicalDevice()
{ {
throw std::runtime_error("failed to find a suitable GPU!"); throw std::runtime_error("failed to find a suitable GPU!");
} }
} }