From f44e83895979132b7e8318c1783111dbe1481c56 Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Mon, 7 Feb 2022 18:06:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BC=D1=8F=D1=82=D1=8C=20=D0=B8=20=D1=81=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B0=20=D0=BE=D1=87=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=B9=20=D0=BA=20=D0=B2=D1=8B=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D1=83=20=D1=83=D1=81=D1=82=D1=80=D0=BE=D0=B9=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/vk.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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!"); } + + }