Flutter Impeller
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 
9 namespace impeller {
10 
11 QueueVK::QueueVK(QueueIndexVK index, vk::Queue queue)
12  : index_(index), queue_(queue) {}
13 
14 QueueVK::~QueueVK() = default;
15 
17  return index_;
18 }
19 
20 vk::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 
26 vk::Result QueueVK::Present(const vk::PresentInfoKHR& present_info) {
27  Lock lock(queue_mutex_);
28  return queue_.presentKHR(present_info);
29 }
30 
31 void 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 
41 QueuesVK::QueuesVK() = default;
42 
43 QueuesVK::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 
75 bool QueuesVK::IsValid() const {
77 }
78 
79 } // namespace impeller
impeller::QueueVK::GetIndex
const QueueIndexVK & GetIndex() const
Definition: queue_vk.cc:16
impeller::QueueIndexVK
Definition: queue_vk.h:15
impeller::QueueIndexVK::index
size_t index
Definition: queue_vk.h:17
impeller::Lock
Definition: thread.h:75
impeller::QueueVK::~QueueVK
~QueueVK()
impeller::QueuesVK::IsValid
bool IsValid() const
Definition: queue_vk.cc:75
impeller::QueuesVK::graphics_queue
std::shared_ptr< QueueVK > graphics_queue
Definition: queue_vk.h:62
queue_vk.h
impeller::QueueVK::Submit
vk::Result Submit(const vk::SubmitInfo &submit_info, const vk::Fence &fence) const
Definition: queue_vk.cc:20
impeller::QueuesVK::transfer_queue
std::shared_ptr< QueueVK > transfer_queue
Definition: queue_vk.h:64
impeller::QueuesVK::compute_queue
std::shared_ptr< QueueVK > compute_queue
Definition: queue_vk.h:63
impeller::ContextVK::SetDebugName
bool SetDebugName(T handle, std::string_view label) const
Definition: context_vk.h:106
impeller::QueueVK::Present
vk::Result Present(const vk::PresentInfoKHR &present_info)
Definition: queue_vk.cc:26
impeller::QueuesVK::QueuesVK
QueuesVK()
impeller::QueueVK::InsertDebugMarker
void InsertDebugMarker(std::string_view label) const
Definition: queue_vk.cc:31
impeller::QueueIndexVK::family
size_t family
Definition: queue_vk.h:16
context_vk.h
impeller::HasValidationLayers
bool HasValidationLayers()
Definition: context_vk.cc:48
impeller
Definition: aiks_blur_unittests.cc:20
impeller::QueueVK::QueueVK
QueueVK(QueueIndexVK index, vk::Queue queue)
Definition: queue_vk.cc:11