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
5
#include "
impeller/renderer/backend/vulkan/queue_vk.h
"
6
7
#include "
impeller/renderer/backend/vulkan/context_vk.h
"
8
9
namespace
impeller
{
10
11
QueueVK::QueueVK
(
QueueIndexVK
index, vk::Queue queue)
12
: index_(index), queue_(queue) {}
13
14
QueueVK::~QueueVK
() =
default
;
15
16
const
QueueIndexVK
&
QueueVK::GetIndex
()
const
{
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
void
QueueVK::InsertDebugMarker
(
const
char
* label)
const
{
27
if
(!
HasValidationLayers
()) {
28
return
;
29
}
30
vk::DebugUtilsLabelEXT label_info;
31
label_info.pLabelName = label;
32
Lock
lock(queue_mutex_);
33
queue_.insertDebugUtilsLabelEXT(label_info);
34
}
35
36
QueuesVK::QueuesVK
() =
default
;
37
38
QueuesVK::QueuesVK
(
const
vk::Device& device,
39
QueueIndexVK
graphics,
40
QueueIndexVK
compute,
41
QueueIndexVK
transfer) {
42
auto
vk_graphics = device.getQueue(graphics.
family
, graphics.
index
);
43
auto
vk_compute = device.getQueue(compute.
family
, compute.
index
);
44
auto
vk_transfer = device.getQueue(transfer.
family
, transfer.
index
);
45
46
// Always set up the graphics queue.
47
graphics_queue
= std::make_shared<QueueVK>(graphics, vk_graphics);
48
ContextVK::SetDebugName
(device, vk_graphics,
"ImpellerGraphicsQ"
);
49
50
// Setup the compute queue if its different from the graphics queue.
51
if
(compute == graphics) {
52
compute_queue
=
graphics_queue
;
53
}
else
{
54
compute_queue
= std::make_shared<QueueVK>(compute, vk_compute);
55
ContextVK::SetDebugName
(device, vk_compute,
"ImpellerComputeQ"
);
56
}
57
58
// Setup the transfer queue if its different from the graphics or compute
59
// queues.
60
if
(transfer == graphics) {
61
transfer_queue
=
graphics_queue
;
62
}
else
if
(transfer == compute) {
63
transfer_queue
=
compute_queue
;
64
}
else
{
65
transfer_queue
= std::make_shared<QueueVK>(transfer, vk_transfer);
66
ContextVK::SetDebugName
(device, vk_transfer,
"ImpellerTransferQ"
);
67
}
68
}
69
70
bool
QueuesVK::IsValid
()
const
{
71
return
graphics_queue
&&
compute_queue
&&
transfer_queue
;
72
}
73
74
}
// 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:54
impeller::QueueVK::~QueueVK
~QueueVK()
impeller::QueuesVK::IsValid
bool IsValid() const
Definition:
queue_vk.cc:70
impeller::QueueVK::InsertDebugMarker
void InsertDebugMarker(const char *label) const
Definition:
queue_vk.cc:26
impeller::QueuesVK::graphics_queue
std::shared_ptr< QueueVK > graphics_queue
Definition:
queue_vk.h:58
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:60
impeller::QueuesVK::compute_queue
std::shared_ptr< QueueVK > compute_queue
Definition:
queue_vk.h:59
impeller::ContextVK::SetDebugName
bool SetDebugName(T handle, std::string_view label) const
Definition:
context_vk.h:96
impeller::QueuesVK::QueuesVK
QueuesVK()
impeller::QueueIndexVK::family
size_t family
Definition:
queue_vk.h:16
context_vk.h
impeller::HasValidationLayers
bool HasValidationLayers()
Definition:
context_vk.cc:40
impeller
Definition:
aiks_context.cc:10
impeller::QueueVK::QueueVK
QueueVK(QueueIndexVK index, vk::Queue queue)
Definition:
queue_vk.cc:11
impeller
renderer
backend
vulkan
queue_vk.cc
Generated by
1.8.17