Flutter Engine
The Flutter Engine
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
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::Submit(const vk::Fence& fence) const {
27 Lock lock(queue_mutex_);
28 return queue_.submit({}, fence);
29}
30
31vk::Result QueueVK::Present(const vk::PresentInfoKHR& present_info) {
32 Lock lock(queue_mutex_);
33 return queue_.presentKHR(present_info);
34}
35
36void QueueVK::InsertDebugMarker(std::string_view label) const {
37 if (!HasValidationLayers()) {
38 return;
39 }
40 vk::DebugUtilsLabelEXT label_info;
41 label_info.pLabelName = label.data();
42 Lock lock(queue_mutex_);
43 queue_.insertDebugUtilsLabelEXT(label_info);
44}
45
46QueuesVK::QueuesVK() = default;
47
48QueuesVK::QueuesVK(const vk::Device& device,
49 QueueIndexVK graphics,
50 QueueIndexVK compute,
51 QueueIndexVK transfer) {
52 auto vk_graphics = device.getQueue(graphics.family, graphics.index);
53 auto vk_compute = device.getQueue(compute.family, compute.index);
54 auto vk_transfer = device.getQueue(transfer.family, transfer.index);
55
56 // Always set up the graphics queue.
57 graphics_queue = std::make_shared<QueueVK>(graphics, vk_graphics);
58 ContextVK::SetDebugName(device, vk_graphics, "ImpellerGraphicsQ");
59
60 // Setup the compute queue if its different from the graphics queue.
61 if (compute == graphics) {
63 } else {
64 compute_queue = std::make_shared<QueueVK>(compute, vk_compute);
65 ContextVK::SetDebugName(device, vk_compute, "ImpellerComputeQ");
66 }
67
68 // Setup the transfer queue if its different from the graphics or compute
69 // queues.
70 if (transfer == graphics) {
72 } else if (transfer == compute) {
74 } else {
75 transfer_queue = std::make_shared<QueueVK>(transfer, vk_transfer);
76 ContextVK::SetDebugName(device, vk_transfer, "ImpellerTransferQ");
77 }
78}
79
80bool QueuesVK::IsValid() const {
82}
83
84} // 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:36
vk::Result Present(const vk::PresentInfoKHR &present_info)
Definition: queue_vk.cc:31
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:65
std::shared_ptr< QueueVK > transfer_queue
Definition: queue_vk.h:66
std::shared_ptr< QueueVK > graphics_queue
Definition: queue_vk.h:64
bool IsValid() const
Definition: queue_vk.cc:80