gstreamer_vulkan/
vulkan_queue.rs

1use crate::VulkanQueue;
2
3use glib::{prelude::*, translate::*};
4
5// rustdoc-stripper-ignore-next
6/// Represents a locked vulkan queue that can be submitted too. The queue is unlock when this struct is dropped.
7#[derive(Debug)]
8pub struct VulkanQueueSubmitGuard<'a> {
9    obj: &'a VulkanQueue,
10}
11
12impl Drop for VulkanQueueSubmitGuard<'_> {
13    fn drop(&mut self) {
14        unsafe {
15            ffi::gst_vulkan_queue_submit_unlock(self.obj.to_glib_none().0);
16        }
17    }
18}
19impl PartialEq for VulkanQueueSubmitGuard<'_> {
20    fn eq(&self, other: &Self) -> bool {
21        self.obj == other.obj
22    }
23}
24impl Eq for VulkanQueueSubmitGuard<'_> {}
25
26pub trait VulkanQueueExtManual: IsA<VulkanQueue> + 'static {
27    // rustdoc-stripper-ignore-next
28    /// Locks the vulkan queue for submission. A struct similar to `MutexGuard` is retured that unlocks the queue once dropped.
29    // rustdoc-stripper-ignore-next-stop
30    /// Locks the queue for command submission using `vkQueueSubmit()` to meet the
31    /// Vulkan requirements for externally synchronised resources.
32    #[doc(alias = "gst_vulkan_queue_submit_lock")]
33    fn submit_lock<'a>(&'a self) -> VulkanQueueSubmitGuard<'a> {
34        unsafe {
35            ffi::gst_vulkan_queue_submit_lock(self.as_ref().to_glib_none().0);
36        }
37        VulkanQueueSubmitGuard {
38            obj: self.upcast_ref(),
39        }
40    }
41}
42impl<O: IsA<VulkanQueue>> VulkanQueueExtManual for O {}