pub struct Semaphore { /* private fields */ }
Expand description
Used to provide synchronization between command buffers during their execution.
It is similar to a fence, except that it is purely on the GPU side. The CPU can’t query a semaphore’s status or wait for it to be signaled.
Implementations
sourceimpl Semaphore
impl Semaphore
sourcepub fn new(
device: Arc<Device>,
create_info: SemaphoreCreateInfo
) -> Result<Semaphore, SemaphoreError>
pub fn new(
device: Arc<Device>,
create_info: SemaphoreCreateInfo
) -> Result<Semaphore, SemaphoreError>
Creates a new Semaphore
.
sourcepub fn from_pool(device: Arc<Device>) -> Result<Semaphore, SemaphoreError>
pub fn from_pool(device: Arc<Device>) -> Result<Semaphore, SemaphoreError>
Takes a semaphore from the vulkano-provided semaphore pool.
If the pool is empty, a new semaphore will be allocated.
Upon drop
, the semaphore is put back into the pool.
For most applications, using the pool should be preferred, in order to avoid creating new semaphores every frame.
sourcepub unsafe fn from_handle(
device: Arc<Device>,
handle: Semaphore,
create_info: SemaphoreCreateInfo
) -> Semaphore
pub unsafe fn from_handle(
device: Arc<Device>,
handle: Semaphore,
create_info: SemaphoreCreateInfo
) -> Semaphore
Creates a new Semaphore
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 export_win32_handle(
&self,
handle_type: ExternalSemaphoreHandleType
) -> Result<*mut c_void, SemaphoreError>
pub fn export_win32_handle(
&self,
handle_type: ExternalSemaphoreHandleType
) -> Result<*mut c_void, SemaphoreError>
Exports the semaphore into a Win32 handle.
The khr_external_semaphore_win32
extension must be enabled on the device.
sourcepub unsafe fn import_win32_handle(
&self,
import_semaphore_win32_handle_info: ImportSemaphoreWin32HandleInfo
) -> Result<(), SemaphoreError>
pub unsafe fn import_win32_handle(
&self,
import_semaphore_win32_handle_info: ImportSemaphoreWin32HandleInfo
) -> Result<(), SemaphoreError>
Imports a semaphore from a Win32 handle.
The khr_external_semaphore_win32
extension must be enabled on the device.
Safety
- In
import_semaphore_win32_handle_info
,handle
must represent a binary semaphore that was exported from Vulkan or a compatible API, with a driver and device UUID equal to those of the device that ownsself
.