diff options
Diffstat (limited to 'src/strategies/low_latency2/semaphore_signal.cc')
| -rw-r--r-- | src/strategies/low_latency2/semaphore_signal.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/strategies/low_latency2/semaphore_signal.cc b/src/strategies/low_latency2/semaphore_signal.cc new file mode 100644 index 0000000..9597b71 --- /dev/null +++ b/src/strategies/low_latency2/semaphore_signal.cc @@ -0,0 +1,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
\ No newline at end of file |
