Skip to main content

gstreamer_vulkan/auto/
vulkan_physical_device.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{VulkanInstance, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "GstVulkanPhysicalDevice")]
11    pub struct VulkanPhysicalDevice(Object<ffi::GstVulkanPhysicalDevice, ffi::GstVulkanPhysicalDeviceClass>) @extends gst::Object;
12
13    match fn {
14        type_ => || ffi::gst_vulkan_physical_device_get_type(),
15    }
16}
17
18impl VulkanPhysicalDevice {
19    pub const NONE: Option<&'static VulkanPhysicalDevice> = None;
20
21    #[doc(alias = "gst_vulkan_physical_device_new")]
22    pub fn new(instance: &impl IsA<VulkanInstance>, device_index: u32) -> VulkanPhysicalDevice {
23        skip_assert_initialized!();
24        unsafe {
25            from_glib_full(ffi::gst_vulkan_physical_device_new(
26                instance.as_ref().to_glib_none().0,
27                device_index,
28            ))
29        }
30    }
31
32    //#[doc(alias = "gst_vulkan_physical_device_type_to_string")]
33    //pub fn type_to_string(type_: /*Ignored*/&vulkan::PhysicalDeviceType) -> glib::GString {
34    //    unsafe { TODO: call ffi:gst_vulkan_physical_device_type_to_string() }
35    //}
36}
37
38unsafe impl Send for VulkanPhysicalDevice {}
39unsafe impl Sync for VulkanPhysicalDevice {}
40
41pub trait VulkanPhysicalDeviceExt: IsA<VulkanPhysicalDevice> + 'static {
42    #[cfg(feature = "v1_26")]
43    #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
44    #[doc(alias = "gst_vulkan_physical_device_check_api_version")]
45    fn check_api_version(&self, major: u32, minor: u32, patch: u32) -> bool {
46        unsafe {
47            from_glib(ffi::gst_vulkan_physical_device_check_api_version(
48                self.as_ref().to_glib_none().0,
49                major,
50                minor,
51                patch,
52            ))
53        }
54    }
55
56    #[cfg(feature = "v1_26")]
57    #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
58    #[doc(alias = "gst_vulkan_physical_device_get_api_version")]
59    #[doc(alias = "get_api_version")]
60    fn api_version(&self) -> (u32, u32, u32) {
61        unsafe {
62            let mut major = std::mem::MaybeUninit::uninit();
63            let mut minor = std::mem::MaybeUninit::uninit();
64            let mut patch = std::mem::MaybeUninit::uninit();
65            ffi::gst_vulkan_physical_device_get_api_version(
66                self.as_ref().to_glib_none().0,
67                major.as_mut_ptr(),
68                minor.as_mut_ptr(),
69                patch.as_mut_ptr(),
70            );
71            (
72                major.assume_init(),
73                minor.assume_init(),
74                patch.assume_init(),
75            )
76        }
77    }
78
79    #[doc(alias = "gst_vulkan_physical_device_get_extension_info")]
80    #[doc(alias = "get_extension_info")]
81    fn extension_info(&self, name: &str) -> Option<u32> {
82        unsafe {
83            let mut spec_version = std::mem::MaybeUninit::uninit();
84            let ret = from_glib(ffi::gst_vulkan_physical_device_get_extension_info(
85                self.as_ref().to_glib_none().0,
86                name.to_glib_none().0,
87                spec_version.as_mut_ptr(),
88            ));
89            if ret {
90                Some(spec_version.assume_init())
91            } else {
92                None
93            }
94        }
95    }
96
97    //#[cfg(feature = "v1_30")]
98    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
99    //#[doc(alias = "gst_vulkan_physical_device_get_features")]
100    //#[doc(alias = "get_features")]
101    //fn features(&self) -> /*Ignored*/Option<vulkan::PhysicalDeviceFeatures2> {
102    //    unsafe { TODO: call ffi:gst_vulkan_physical_device_get_features() }
103    //}
104
105    //#[doc(alias = "gst_vulkan_physical_device_get_handle")]
106    //#[doc(alias = "get_handle")]
107    //fn handle(&self) -> /*Ignored*/vulkan::PhysicalDevice {
108    //    unsafe { TODO: call ffi:gst_vulkan_physical_device_get_handle() }
109    //}
110
111    #[doc(alias = "gst_vulkan_physical_device_get_instance")]
112    #[doc(alias = "get_instance")]
113    fn instance(&self) -> VulkanInstance {
114        unsafe {
115            from_glib_full(ffi::gst_vulkan_physical_device_get_instance(
116                self.as_ref().to_glib_none().0,
117            ))
118        }
119    }
120
121    #[doc(alias = "gst_vulkan_physical_device_get_layer_info")]
122    #[doc(alias = "get_layer_info")]
123    fn layer_info(&self, name: &str) -> Option<(Option<glib::GString>, u32, u32)> {
124        unsafe {
125            let mut description = std::ptr::null_mut();
126            let mut spec_version = std::mem::MaybeUninit::uninit();
127            let mut implementation_version = std::mem::MaybeUninit::uninit();
128            let ret = from_glib(ffi::gst_vulkan_physical_device_get_layer_info(
129                self.as_ref().to_glib_none().0,
130                name.to_glib_none().0,
131                &mut description,
132                spec_version.as_mut_ptr(),
133                implementation_version.as_mut_ptr(),
134            ));
135            if ret {
136                Some((
137                    from_glib_full(description),
138                    spec_version.assume_init(),
139                    implementation_version.assume_init(),
140                ))
141            } else {
142                None
143            }
144        }
145    }
146
147    //#[cfg(feature = "v1_30")]
148    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
149    //#[doc(alias = "gst_vulkan_physical_device_get_properties")]
150    //#[doc(alias = "get_properties")]
151    //fn properties(&self) -> /*Ignored*/Option<vulkan::PhysicalDeviceProperties2> {
152    //    unsafe { TODO: call ffi:gst_vulkan_physical_device_get_properties() }
153    //}
154
155    #[doc(alias = "device-index")]
156    fn device_index(&self) -> u32 {
157        ObjectExt::property(self.as_ref(), "device-index")
158    }
159}
160
161impl<O: IsA<VulkanPhysicalDevice>> VulkanPhysicalDeviceExt for O {}