Merge #175
175: Add event functions r=MaikKlein a=MaikKlein Fixes https://github.com/MaikKlein/ash/issues/174 Co-authored-by: Maik Klein <maikklein@googlemail.com>
This commit is contained in:
commit
68a1d2aaa2
1 changed files with 88 additions and 0 deletions
|
@ -256,6 +256,94 @@ pub trait DeviceV1_0 {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe fn create_event(
|
||||||
|
&self,
|
||||||
|
create_info: &vk::EventCreateInfo,
|
||||||
|
allocation_callbacks: Option<&vk::AllocationCallbacks>,
|
||||||
|
) -> VkResult<vk::Event> {
|
||||||
|
let mut event = mem::uninitialized();
|
||||||
|
let err_code = self.fp_v1_0().create_event(
|
||||||
|
self.handle(),
|
||||||
|
create_info,
|
||||||
|
allocation_callbacks.as_raw_ptr(),
|
||||||
|
&mut event,
|
||||||
|
);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::SUCCESS => Ok(event),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns true if the event was set, and false if the event was reset, otherwise it will
|
||||||
|
/// return the error code.
|
||||||
|
unsafe fn get_event_status(&self, event: vk::Event) -> VkResult<bool> {
|
||||||
|
let err_code = self.fp_v1_0().get_event_status(self.handle(), event);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::EVENT_SET => Ok(true),
|
||||||
|
vk::Result::EVENT_RESET => Ok(false),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn set_event(&self, event: vk::Event) -> VkResult<()> {
|
||||||
|
let err_code = self.fp_v1_0().set_event(self.handle(), event);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::SUCCESS => Ok(()),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn reset_event(&self, event: vk::Event) -> VkResult<()> {
|
||||||
|
let err_code = self.fp_v1_0().reset_event(self.handle(), event);
|
||||||
|
match err_code {
|
||||||
|
vk::Result::SUCCESS => Ok(()),
|
||||||
|
_ => Err(err_code),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unsafe fn cmd_set_event(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
event: vk::Event,
|
||||||
|
stage_mask: vk::PipelineStageFlags,
|
||||||
|
) {
|
||||||
|
self.fp_v1_0()
|
||||||
|
.cmd_set_event(command_buffer, event, stage_mask);
|
||||||
|
}
|
||||||
|
unsafe fn cmd_reset_event(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
event: vk::Event,
|
||||||
|
stage_mask: vk::PipelineStageFlags,
|
||||||
|
) {
|
||||||
|
self.fp_v1_0()
|
||||||
|
.cmd_reset_event(command_buffer, event, stage_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn cmd_wait_events(
|
||||||
|
&self,
|
||||||
|
command_buffer: vk::CommandBuffer,
|
||||||
|
events: &[vk::Event],
|
||||||
|
src_stage_mask: vk::PipelineStageFlags,
|
||||||
|
dst_stage_mask: vk::PipelineStageFlags,
|
||||||
|
memory_barriers: &[vk::MemoryBarrier],
|
||||||
|
buffer_memory_barriers: &[vk::BufferMemoryBarrier],
|
||||||
|
image_memory_barriers: &[vk::ImageMemoryBarrier],
|
||||||
|
) {
|
||||||
|
self.fp_v1_0().cmd_wait_events(
|
||||||
|
command_buffer,
|
||||||
|
events.len() as _,
|
||||||
|
events.as_ptr(),
|
||||||
|
src_stage_mask,
|
||||||
|
dst_stage_mask,
|
||||||
|
memory_barriers.len() as _,
|
||||||
|
memory_barriers.as_ptr(),
|
||||||
|
buffer_memory_barriers.len() as _,
|
||||||
|
buffer_memory_barriers.as_ptr(),
|
||||||
|
image_memory_barriers.len() as _,
|
||||||
|
image_memory_barriers.as_ptr(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
unsafe fn destroy_fence(
|
unsafe fn destroy_fence(
|
||||||
&self,
|
&self,
|
||||||
fence: vk::Fence,
|
fence: vk::Fence,
|
||||||
|
|
Loading…
Add table
Reference in a new issue