Skip to content

Commit dffdf43

Browse files
committed
Add support for directly waiting on a proxy timeline.
1 parent 75b82eb commit dffdf43

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

vulkan/semaphore.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ void SemaphoreHolder::recycle_semaphore()
8282
}
8383
}
8484

85+
bool SemaphoreHolder::wait_timeline_timeout(uint64_t value, uint64_t timeout)
86+
{
87+
VK_ASSERT(semaphore_type == VK_SEMAPHORE_TYPE_TIMELINE);
88+
VK_ASSERT(is_proxy_timeline());
89+
90+
VkSemaphoreWaitInfo wait_info = { VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO };
91+
wait_info.pSemaphores = &semaphore;
92+
wait_info.semaphoreCount = 1;
93+
wait_info.pValues = &value;
94+
return device->get_device_table().vkWaitSemaphores(device->get_device(), &wait_info, timeout) == VK_SUCCESS;
95+
}
96+
97+
void SemaphoreHolder::wait_timeline(uint64_t value)
98+
{
99+
wait_timeline_timeout(value, UINT64_MAX);
100+
}
101+
85102
SemaphoreHolder &SemaphoreHolder::operator=(SemaphoreHolder &&other) noexcept
86103
{
87104
if (this == &other)

vulkan/semaphore.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ class SemaphoreHolder : public Util::IntrusivePtrEnabled<SemaphoreHolder, Semaph
158158

159159
SemaphoreHolder &operator=(SemaphoreHolder &&other) noexcept;
160160

161+
void wait_timeline(uint64_t value);
162+
bool wait_timeline_timeout(uint64_t value, uint64_t timeout);
163+
161164
private:
162165
friend class Util::ObjectPool<SemaphoreHolder>;
163166
SemaphoreHolder(Device *device_, VkSemaphore semaphore_, bool signalled_, bool owned_)

0 commit comments

Comments
 (0)