| 3174 | } |
| 3175 | |
| 3176 | std::shared_ptr<device_queue> vulkan_context::create_queue_internal(const device& dev, const uint32_t family_index, |
| 3177 | const device_queue::QUEUE_TYPE queue_type, |
| 3178 | uint32_t& queue_index) const { |
| 3179 | const auto& vulkan_dev = (const vulkan_device&)dev; |
| 3180 | |
| 3181 | // can only create a certain amount of queues per device with Vulkan, so handle this + handle the queue index |
| 3182 | if (queue_index >= vulkan_dev.queue_counts[family_index]) { |
| 3183 | log_warn("too many queues were created for family $ (max: $), wrapping around to #0 again", |
| 3184 | family_index, vulkan_dev.queue_counts[family_index]); |
| 3185 | queue_index = 0; |
| 3186 | } |
| 3187 | const auto next_queue_index = queue_index++; |
| 3188 | |
| 3189 | VkQueue queue_obj; |
| 3190 | vkGetDeviceQueue(vulkan_dev.device, family_index, next_queue_index, &queue_obj); |
| 3191 | if (queue_obj == nullptr) { |
| 3192 | log_error("failed to retrieve Vulkan device queue"); |
| 3193 | return {}; |
| 3194 | } |
| 3195 | |
| 3196 | const std::string queue_name = (family_index == vulkan_dev.all_queue_family_index ? |
| 3197 | "queue:" + (next_queue_index == 0 ? "default" : std::to_string(next_queue_index)) : |
| 3198 | "device_queue:" + (next_queue_index == 0 ? "default" : std::to_string(next_queue_index))); |
| 3199 | set_vulkan_debug_label(vulkan_dev, VK_OBJECT_TYPE_QUEUE, uint64_t(queue_obj), queue_name); |
| 3200 | |
| 3201 | auto ret = std::make_shared<vulkan_queue>(dev, queue_obj, family_index, next_queue_index, queue_type); |
| 3202 | queues.push_back(ret); |
| 3203 | return ret; |
| 3204 | } |
| 3205 | |
| 3206 | std::shared_ptr<device_queue> vulkan_context::create_queue(const device& dev) const { |
| 3207 | const auto& vulkan_dev = (const vulkan_device&)dev; |
nothing calls this directly
no test coverage detected