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