Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
queue_vk.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
8
9namespace impeller {
10
11QueueVK::QueueVK(QueueIndexVK index, vk::Queue queue)
12 : index_(index), queue_(queue) {}
13
14QueueVK::~QueueVK() = default;
15
17 return index_;
18}
19
20vk::Result QueueVK::Submit(const vk::SubmitInfo& submit_info,
21 const vk::Fence& fence) const {
22 Lock lock(queue_mutex_);
23 return queue_.submit(submit_info, fence);
24}
25
26vk::Result QueueVK::Present(const vk::PresentInfoKHR& present_info) {
27 Lock lock(queue_mutex_);
28 return queue_.presentKHR(present_info);
29}
30
31void QueueVK::InsertDebugMarker(std::string_view label) const {
32 if (!HasValidationLayers()) {
33 return;
34 }
35 vk::DebugUtilsLabelEXT label_info;
36 label_info.pLabelName = label.data();
37 Lock lock(queue_mutex_);
38 queue_.insertDebugUtilsLabelEXT(label_info);
39}
40
41QueuesVK::QueuesVK() = default;
42
43QueuesVK::QueuesVK(const vk::Device& device,
44 QueueIndexVK graphics,
45 QueueIndexVK compute,
46 QueueIndexVK transfer) {
47 auto vk_graphics = device.getQueue(graphics.family, graphics.index);
48 auto vk_compute = device.getQueue(compute.family, compute.index);
49 auto vk_transfer = device.getQueue(transfer.family, transfer.index);
50
51 // Always set up the graphics queue.
52 graphics_queue = std::make_shared<QueueVK>(graphics, vk_graphics);
53 ContextVK::SetDebugName(device, vk_graphics, "ImpellerGraphicsQ");
54
55 // Setup the compute queue if its different from the graphics queue.
56 if (compute == graphics) {
58 } else {
59 compute_queue = std::make_shared<QueueVK>(compute, vk_compute);
60 ContextVK::SetDebugName(device, vk_compute, "ImpellerComputeQ");
61 }
62
63 // Setup the transfer queue if its different from the graphics or compute
64 // queues.
65 if (transfer == graphics) {
67 } else if (transfer == compute) {
69 } else {
70 transfer_queue = std::make_shared<QueueVK>(transfer, vk_transfer);
71 ContextVK::SetDebugName(device, vk_transfer, "ImpellerTransferQ");
72 }
73}
74
78
79} // namespace impeller
bool SetDebugName(T handle, std::string_view label) const
Definition context_vk.h:108
QueueVK(QueueIndexVK index, vk::Queue queue)
Definition queue_vk.cc:11
const QueueIndexVK & GetIndex() const
Definition queue_vk.cc:16
void InsertDebugMarker(std::string_view label) const
Definition queue_vk.cc:31
vk::Result Present(const vk::PresentInfoKHR &present_info)
Definition queue_vk.cc:26
vk::Result Submit(const vk::SubmitInfo &submit_info, const vk::Fence &fence) const
Definition queue_vk.cc:20
VkDevice device
Definition main.cc:53
VkQueue queue
Definition main.cc:55
bool HasValidationLayers()
Definition context_vk.cc:48
std::shared_ptr< QueueVK > compute_queue
Definition queue_vk.h:63
std::shared_ptr< QueueVK > transfer_queue
Definition queue_vk.h:64
std::shared_ptr< QueueVK > graphics_queue
Definition queue_vk.h:62
bool IsValid() const
Definition queue_vk.cc:75