pub struct Fence { /* private fields */ }
Expand description
A fence is used to know when a command buffer submission has finished its execution.
When a command buffer accesses a resource, you have to ensure that the CPU doesn’t access the same resource simultaneously (except for concurrent reads). Therefore in order to know when the CPU can access a resource again, a fence has to be used.
Implementations
sourceimpl Fence
impl Fence
sourcepub fn new(
device: Arc<Device>,
create_info: FenceCreateInfo
) -> Result<Fence, FenceError>
pub fn new(
device: Arc<Device>,
create_info: FenceCreateInfo
) -> Result<Fence, FenceError>
Creates a new Fence
.
sourcepub fn from_pool(device: Arc<Device>) -> Result<Fence, FenceError>
pub fn from_pool(device: Arc<Device>) -> Result<Fence, FenceError>
Takes a fence from the vulkano-provided fence pool.
If the pool is empty, a new fence will be created.
Upon drop
, the fence is put back into the pool.
For most applications, using the fence pool should be preferred, in order to avoid creating new fences every frame.
sourcepub unsafe fn from_handle(
device: Arc<Device>,
handle: Fence,
create_info: FenceCreateInfo
) -> Fence
pub unsafe fn from_handle(
device: Arc<Device>,
handle: Fence,
create_info: FenceCreateInfo
) -> Fence
Creates a new Fence
from a raw object handle.
Safety
handle
must be a valid Vulkan object handle created fromdevice
.create_info
must match the info used to create the object.
sourcepub fn is_signaled(&self) -> Result<bool, OomError>
pub fn is_signaled(&self) -> Result<bool, OomError>
Returns true if the fence is signaled.
sourcepub fn wait(&self, timeout: Option<Duration>) -> Result<(), FenceError>
pub fn wait(&self, timeout: Option<Duration>) -> Result<(), FenceError>
Waits until the fence is signaled, or at least until the timeout duration has elapsed.
Returns Ok
if the fence is now signaled. Returns Err
if the timeout was reached instead.
If you pass a duration of 0, then the function will return without blocking.