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