23 uint8_t
Device::addQueues(VkQueueFlags queueFlags,
const std::vector<std::string>& queuesNames) {
26 for (
const std::string& queueName: queuesNames) {
27 if (!
addQueue(queueFlags, queueName)) {
30 if (queueFlags & VK_QUEUE_TRANSFER_BIT) {
33 VkQueueFlags queueFlagsTmp = queueFlags & ~VK_QUEUE_TRANSFER_BIT;
34 if (!
addQueue(queueFlagsTmp | VK_QUEUE_GRAPHICS_BIT, queueName) &&
35 !
addQueue(queueFlagsTmp | VK_QUEUE_COMPUTE_BIT, queueName)) {
50 std::vector<VkDeviceQueueCreateInfo> queueCreateInfos{};
51 const float priorities[256] = {1.0f};
58 const VkDeviceQueueCreateInfo queueCreateInfo {
59 VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
67 queueCreateInfos.push_back(std::move(queueCreateInfo));
71 const VkDeviceCreateInfo createInfo{
72 VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
75 static_cast<uint32_t
>(queueCreateInfos.size()),
76 queueCreateInfos.data(),
85 VkDevice vkDevice{VK_NULL_HANDLE};
89 *returnResult = result;
92 if (result != VK_SUCCESS) {
98 auto getDeviceQueue = device.
getProcAddr<PFN_vkGetDeviceQueue>(
"vkGetDeviceQueue");
99 if (!getDeviceQueue) {
100 LUG_LOG.error(
"Device::addQueue: Can't load function vkGetDeviceQueue");
118 VkQueue queue{VK_NULL_HANDLE};
119 getDeviceQueue(static_cast<VkDevice>(device), i, j, &queue);
121 queueFamily._queues.push_back(
API::Queue(queue, &queueFamily));
124 queueFamily._queuesIndices[name] =
static_cast<uint32_t
>(queueFamily._queues.size() - 1);
134 std::unique_ptr<API::Device> device = std::make_unique<API::Device>();
135 return build(*device, returnResult) ? std::move(device) :
nullptr;
std::vector< VkQueueFamilyProperties > queueFamilies
VkPhysicalDeviceFeatures _features
Function getProcAddr(const char *name) const
bool addQueue(VkQueueFlags queueFlags, const std::string &queueName)
std::vector< QueueFamily > _queueFamiliesInfos
uint8_t addQueues(VkQueueFlags queueFlags, const std::vector< std::string > &queuesNames)
bool build(API::Device &device, VkResult *returnResult=nullptr)
Device(const PhysicalDeviceInfo &physicalDeviceInfo)
std::vector< QueueFamily > _queueFamilies
std::vector< const char * > _extensions
const PhysicalDeviceInfo & _physicalDeviceInfo