VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | Static Public Member Functions | List of all members
vpp::Fence Class Reference

Allows the CPU to wait for GPU operation to finish. More...

#include <vppSynchronization.hpp>

Public Member Functions

 Fence ()
 Constructs null reference.
 
 Fence (const Device &hDevice, bool bSignaled=false)
 Constructs a fence on specified device. More...
 
VkFence handle () const
 Retrieves the Vulkan handle.
 
const Devicedevice () const
 Retrieves the device.
 
bool isSignaled () const
 Checks whether the fence is currently in signaled state.
 
void reset ()
 Resets the fence to unsignaled state.
 
bool wait (std::uint64_t timeoutNs=std::numeric_limits< std::uint64_t >::max()) const
 Waits until the fence becomes signaled. More...
 

Static Public Member Functions

static void reset (std::vector< Fence > *pFences)
 Resets all given fences to unsignaled state.
 
static bool waitAll (std::vector< Fence > *pFences, std::uint64_t timeoutNs=std::numeric_limits< std::uint64_t >::max())
 Waits until all given fences become signaled. More...
 
static bool waitOne (std::vector< Fence > *pFences, std::uint64_t timeoutNs=std::numeric_limits< std::uint64_t >::max())
 Waits until one of given fences becomes signaled. More...
 
static bool waitAll (const Device &hDevice, std::vector< VkFence > *pFences, std::uint64_t timeoutNs=std::numeric_limits< std::uint64_t >::max())
 
static bool waitOne (const Device &hDevice, std::vector< VkFence > *pFences, std::uint64_t timeoutNs=std::numeric_limits< std::uint64_t >::max())
 

Detailed Description

Allows the CPU to wait for GPU operation to finish.

Many of VPP operations (esp. queue submission) accept optional Fence argument, allowing to wait on CPU side untile the operation finishes. When that happens, the fence is being set to signaled state.

This object is reference-counted and may be passed by value.

Constructor & Destructor Documentation

◆ Fence()

vpp::Fence::Fence ( const Device hDevice,
bool  bSignaled = false 
)

Constructs a fence on specified device.

You can optionally specify the initial fence state: signaled or unsignaled.

Member Function Documentation

◆ wait()

bool vpp::Fence::wait ( std::uint64_t  timeoutNs = std::numeric_limits< std::uint64_t >::max()) const

Waits until the fence becomes signaled.

Optionally allows to specify a timeout in nanoseconds. When omitted, the wait will be for indefinite time (may hang the application).

Returns true if the fence has really been signaled. Returns false if waiting has been interrupted by a timeout.

◆ waitAll() [1/2]

static bool vpp::Fence::waitAll ( std::vector< Fence > *  pFences,
std::uint64_t  timeoutNs = std::numeric_limits< std::uint64_t >::max() 
)
static

Waits until all given fences become signaled.

Optionally allows to specify a timeout in nanoseconds. When omitted, the wait will be for indefinite time (may hang the application).

Returns true if fences have really been signaled. Returns false if waiting has been interrupted by a timeout.

◆ waitAll() [2/2]

static bool vpp::Fence::waitAll ( const Device hDevice,
std::vector< VkFence > *  pFences,
std::uint64_t  timeoutNs = std::numeric_limits< std::uint64_t >::max() 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ waitOne() [1/2]

static bool vpp::Fence::waitOne ( std::vector< Fence > *  pFences,
std::uint64_t  timeoutNs = std::numeric_limits< std::uint64_t >::max() 
)
static

Waits until one of given fences becomes signaled.

Optionally allows to specify a timeout in nanoseconds. When omitted, the wait will be for indefinite time (may hang the application).

Returns true if a fence have really been signaled. Returns false if waiting has been interrupted by a timeout.

◆ waitOne() [2/2]

static bool vpp::Fence::waitOne ( const Device hDevice,
std::vector< VkFence > *  pFences,
std::uint64_t  timeoutNs = std::numeric_limits< std::uint64_t >::max() 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


The documentation for this class was generated from the following file: