pub struct Event { /* private fields */ }
Expand description
Used to block the GPU execution until an event on the CPU occurs.
Note that Vulkan implementations may have limits on how long a command buffer will wait for an event to be signaled, in order to avoid interfering with progress of other clients of the GPU. If the event isn’t signaled within these limits, results are undefined and may include device loss.
Implementations§
source§impl Event
impl Event
sourcepub fn new(
device: Arc<Device>,
create_info: EventCreateInfo
) -> Result<Event, Validated<VulkanError>>
pub fn new( device: Arc<Device>, create_info: EventCreateInfo ) -> Result<Event, Validated<VulkanError>>
Creates a new Event
.
On portability subset
devices, the
events
feature must be enabled on the device.
sourcepub fn from_pool(device: Arc<Device>) -> Result<Event, VulkanError>
pub fn from_pool(device: Arc<Device>) -> Result<Event, VulkanError>
Takes an event from the vulkano-provided event pool.
If the pool is empty, a new event will be allocated.
Upon drop
, the event is put back into the pool.
For most applications, using the event pool should be preferred, in order to avoid creating new events every frame.
sourcepub unsafe fn from_handle(
device: Arc<Device>,
handle: Event,
create_info: EventCreateInfo
) -> Event
pub unsafe fn from_handle( device: Arc<Device>, handle: Event, create_info: EventCreateInfo ) -> Event
Creates a new Event
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 flags(&self) -> EventCreateFlags
pub fn flags(&self) -> EventCreateFlags
Returns the flags that the event was created with.
sourcepub fn is_signaled(&self) -> Result<bool, Validated<VulkanError>>
pub fn is_signaled(&self) -> Result<bool, Validated<VulkanError>>
Returns true if the event is signaled.
sourcepub fn set(&mut self) -> Result<(), Validated<VulkanError>>
pub fn set(&mut self) -> Result<(), Validated<VulkanError>>
Changes the Event
to the signaled state.
If a command buffer is waiting on this event, it is then unblocked.
sourcepub unsafe fn reset(&mut self) -> Result<(), Validated<VulkanError>>
pub unsafe fn reset(&mut self) -> Result<(), Validated<VulkanError>>
Changes the Event
to the unsignaled state.
Safety
- There must be an execution dependency between
reset
and the execution of any
wait_events
command that includes this event in itsevents
parameter.