From f53f481f7826494b130285d8237f4981281b310f Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Tue, 8 Feb 2022 12:21:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20=D0=BF=D0=BE=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=B0?= =?UTF-8?q?=20=D1=81=D0=B5=D0=BC=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D1=84=D0=BB=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/PhysicalDevice.h | 2 ++ src/PhysicalDevice.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/PhysicalDevice.cpp diff --git a/include/PhysicalDevice.h b/include/PhysicalDevice.h index 48f51bd..23b5e41 100644 --- a/include/PhysicalDevice.h +++ b/include/PhysicalDevice.h @@ -12,6 +12,8 @@ typedef struct _PhysicalDevice VkPhysicalDeviceFeatures features; // функции VkPhysicalDeviceMemoryProperties memory; // память std::vector queueFamilyProperties; // семейства очередей + + uint32_t pickQueueFamily(VkQueueFlags); } PhysicalDevice; #endif // PHYSICALDEVICE_H diff --git a/src/PhysicalDevice.cpp b/src/PhysicalDevice.cpp new file mode 100644 index 0000000..92fbf4a --- /dev/null +++ b/src/PhysicalDevice.cpp @@ -0,0 +1,16 @@ +#include "PhysicalDevice.h" + +// Возвращает индекс первой попавшейся очереди, соответствующей требуемым флагам +uint32_t PhysicalDevice::pickQueueFamily(VkQueueFlags flags) +{ + // Цикл по параметрам семейств очередей + for (uint32_t index = 0; index < queueFamilyProperties.size(); index++) + { + // Если очередь соответствует требованиям по возможностям очереди + if (queueFamilyProperties[index].queueFlags & flags) + { + // возвращаем её индекс + return index; + } + } +} \ No newline at end of file