blob: 9597b71030a037d6da2ee4301f1b3d2767a9f192 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "semaphore_signal.hh"
#include "helper.hh"
namespace low_latency {
SemaphoreSignal::SemaphoreSignal(const VkSemaphore& semaphore,
const std::uint64_t& value)
: semaphore(semaphore), value(value) {}
SemaphoreSignal::~SemaphoreSignal() {}
void SemaphoreSignal::signal(const DeviceContext& device) const {
auto current = std::uint64_t{};
THROW_NOT_VKSUCCESS(device.vtable.GetSemaphoreCounterValue(
device.device, this->semaphore, ¤t));
// Don't signal if it has already been signalled.
if (current >= this->value) {
return;
}
const auto ssi =
VkSemaphoreSignalInfo{.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO,
.semaphore = this->semaphore,
.value = this->value};
THROW_NOT_VKSUCCESS(device.vtable.SignalSemaphore(device.device, &ssi));
}
} // namespace low_latency
|