libcruft-vk/fence.cpp

40 lines
1006 B
C++
Raw Normal View History

2016-02-24 11:11:41 +11:00
#include "./fence.hpp"
#include "./device.hpp"
using vk::fence;
///////////////////////////////////////////////////////////////////////////////
bool
fence::is_ready (const device &dev)
{
auto res = vkGetFenceStatus (dev.id (), id ());
error::try_code (res);
return res == VK_SUCCESS;
}
///////////////////////////////////////////////////////////////////////////////
void
fence::reset (const device &dev, fence *first, fence *last)
{
vkResetFences (dev.id (), last - first, &first->id ());
}
//-----------------------------------------------------------------------------
void
fence::wait (const device &d, fence *first, fence *last, uint64_t timeout)
{
vkWaitForFences (d.id (), last - first, &first->id (), VK_FALSE, timeout);
}
//-----------------------------------------------------------------------------
void
fence::wait_all (const device &d, fence *first, fence *last, uint64_t timeout)
{
vkWaitForFences (d.id (), last - first, &first->id (), VK_TRUE, timeout);
}