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::{ffi, VulkanInstance};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 ///
11 ///
12 /// ## Properties
13 ///
14 ///
15 /// #### `device-index`
16 /// Readable | Writeable | Construct Only
17 ///
18 ///
19 /// #### `instance`
20 /// Readable | Writeable | Construct Only
21 ///
22 ///
23 /// #### `name`
24 /// Readable
25 /// <details><summary><h4>Object</h4></summary>
26 ///
27 ///
28 /// #### `name`
29 /// Readable | Writeable | Construct
30 ///
31 ///
32 /// #### `parent`
33 /// The parent of the object. Please note, that when changing the 'parent'
34 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
35 /// signals due to locking issues. In some cases one can use
36 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
37 /// achieve a similar effect.
38 ///
39 /// Readable | Writeable
40 /// </details>
41 ///
42 /// # Implements
43 ///
44 /// [`VulkanPhysicalDeviceExt`][trait@crate::prelude::VulkanPhysicalDeviceExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
45 #[doc(alias = "GstVulkanPhysicalDevice")]
46 pub struct VulkanPhysicalDevice(Object<ffi::GstVulkanPhysicalDevice, ffi::GstVulkanPhysicalDeviceClass>) @extends gst::Object;
47
48 match fn {
49 type_ => || ffi::gst_vulkan_physical_device_get_type(),
50 }
51}
52
53impl VulkanPhysicalDevice {
54 pub const NONE: Option<&'static VulkanPhysicalDevice> = None;
55
56 /// ## `instance`
57 /// the parent [`VulkanInstance`][crate::VulkanInstance]
58 ///
59 /// # Returns
60 ///
61 /// a new [`VulkanPhysicalDevice`][crate::VulkanPhysicalDevice]
62 #[doc(alias = "gst_vulkan_physical_device_new")]
63 pub fn new(instance: &impl IsA<VulkanInstance>, device_index: u32) -> VulkanPhysicalDevice {
64 skip_assert_initialized!();
65 unsafe {
66 from_glib_full(ffi::gst_vulkan_physical_device_new(
67 instance.as_ref().to_glib_none().0,
68 device_index,
69 ))
70 }
71 }
72
73 //#[doc(alias = "gst_vulkan_physical_device_type_to_string")]
74 //pub fn type_to_string(type_: /*Ignored*/&vulkan::PhysicalDeviceType) -> glib::GString {
75 // unsafe { TODO: call ffi:gst_vulkan_physical_device_type_to_string() }
76 //}
77}
78
79unsafe impl Send for VulkanPhysicalDevice {}
80unsafe impl Sync for VulkanPhysicalDevice {}
81
82/// Trait containing all [`struct@VulkanPhysicalDevice`] methods.
83///
84/// # Implementors
85///
86/// [`VulkanPhysicalDevice`][struct@crate::VulkanPhysicalDevice]
87pub trait VulkanPhysicalDeviceExt: IsA<VulkanPhysicalDevice> + 'static {
88 /// Note: This is the intersection of the exposed supported API version as would
89 /// be returned by [`api_version()`][Self::api_version()] and
90 /// [`VulkanInstanceExt::check_version()`][crate::prelude::VulkanInstanceExt::check_version()]. The latter will take into account any
91 /// requested API version and may result in a different result than directly
92 /// comparing against [`VulkanInstanceExt::version()`][crate::prelude::VulkanInstanceExt::version()].
93 /// ## `major`
94 /// the API major version to check
95 /// ## `minor`
96 /// the API minor version to check
97 /// ## `patch`
98 /// the API patch version to check
99 ///
100 /// # Returns
101 ///
102 /// whether the [`VulkanPhysicalDevice`][crate::VulkanPhysicalDevice] supports the version specified
103 /// by `major`, `minor` and `patch`.
104 #[cfg(feature = "v1_26")]
105 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
106 #[doc(alias = "gst_vulkan_physical_device_check_api_version")]
107 fn check_api_version(&self, major: u32, minor: u32, patch: u32) -> bool {
108 unsafe {
109 from_glib(ffi::gst_vulkan_physical_device_check_api_version(
110 self.as_ref().to_glib_none().0,
111 major,
112 minor,
113 patch,
114 ))
115 }
116 }
117
118 /// Retrieves the advertised Vulkan API version of the [`VulkanPhysicalDevice`][crate::VulkanPhysicalDevice].
119 ///
120 /// # Returns
121 ///
122 ///
123 /// ## `major`
124 /// major version
125 ///
126 /// ## `minor`
127 /// minor version
128 ///
129 /// ## `patch`
130 /// patch version
131 #[cfg(feature = "v1_26")]
132 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
133 #[doc(alias = "gst_vulkan_physical_device_get_api_version")]
134 #[doc(alias = "get_api_version")]
135 fn api_version(&self) -> (u32, u32, u32) {
136 unsafe {
137 let mut major = std::mem::MaybeUninit::uninit();
138 let mut minor = std::mem::MaybeUninit::uninit();
139 let mut patch = std::mem::MaybeUninit::uninit();
140 ffi::gst_vulkan_physical_device_get_api_version(
141 self.as_ref().to_glib_none().0,
142 major.as_mut_ptr(),
143 minor.as_mut_ptr(),
144 patch.as_mut_ptr(),
145 );
146 (
147 major.assume_init(),
148 minor.assume_init(),
149 patch.assume_init(),
150 )
151 }
152 }
153
154 /// Retrieves information about a device extension.
155 ///
156 /// Will not find any extensions before [`VulkanInstanceExt::fill_info()`][crate::prelude::VulkanInstanceExt::fill_info()] has been
157 /// called.
158 /// ## `name`
159 /// the extension name to look for
160 ///
161 /// # Returns
162 ///
163 /// whether extension `name` is available
164 ///
165 /// ## `spec_version`
166 /// return value for the exteion specification version
167 #[doc(alias = "gst_vulkan_physical_device_get_extension_info")]
168 #[doc(alias = "get_extension_info")]
169 fn extension_info(&self, name: &str) -> Option<u32> {
170 unsafe {
171 let mut spec_version = std::mem::MaybeUninit::uninit();
172 let ret = from_glib(ffi::gst_vulkan_physical_device_get_extension_info(
173 self.as_ref().to_glib_none().0,
174 name.to_glib_none().0,
175 spec_version.as_mut_ptr(),
176 ));
177 if ret {
178 Some(spec_version.assume_init())
179 } else {
180 None
181 }
182 }
183 }
184
185 //#[doc(alias = "gst_vulkan_physical_device_get_handle")]
186 //#[doc(alias = "get_handle")]
187 //fn handle(&self) -> /*Ignored*/vulkan::PhysicalDevice {
188 // unsafe { TODO: call ffi:gst_vulkan_physical_device_get_handle() }
189 //}
190
191 ///
192 /// # Returns
193 ///
194 /// The [`VulkanInstance`][crate::VulkanInstance] associated with this physical device
195 #[doc(alias = "gst_vulkan_physical_device_get_instance")]
196 #[doc(alias = "get_instance")]
197 fn instance(&self) -> VulkanInstance {
198 unsafe {
199 from_glib_full(ffi::gst_vulkan_physical_device_get_instance(
200 self.as_ref().to_glib_none().0,
201 ))
202 }
203 }
204
205 /// Retrieves information about a layer.
206 ///
207 /// Will not find any layers before [`VulkanInstanceExt::fill_info()`][crate::prelude::VulkanInstanceExt::fill_info()] has been
208 /// called.
209 /// ## `name`
210 /// the layer name to look for
211 ///
212 /// # Returns
213 ///
214 /// whether layer `name` is available
215 ///
216 /// ## `description`
217 /// return value for the layer description or [`None`]
218 ///
219 /// ## `spec_version`
220 /// return value for the layer specification version
221 ///
222 /// ## `implementation_version`
223 /// return value for the layer implementation version
224 #[doc(alias = "gst_vulkan_physical_device_get_layer_info")]
225 #[doc(alias = "get_layer_info")]
226 fn layer_info(&self, name: &str) -> Option<(Option<glib::GString>, u32, u32)> {
227 unsafe {
228 let mut description = std::ptr::null_mut();
229 let mut spec_version = std::mem::MaybeUninit::uninit();
230 let mut implementation_version = std::mem::MaybeUninit::uninit();
231 let ret = from_glib(ffi::gst_vulkan_physical_device_get_layer_info(
232 self.as_ref().to_glib_none().0,
233 name.to_glib_none().0,
234 &mut description,
235 spec_version.as_mut_ptr(),
236 implementation_version.as_mut_ptr(),
237 ));
238 if ret {
239 Some((
240 from_glib_full(description),
241 spec_version.assume_init(),
242 implementation_version.assume_init(),
243 ))
244 } else {
245 None
246 }
247 }
248 }
249
250 #[doc(alias = "device-index")]
251 fn device_index(&self) -> u32 {
252 ObjectExt::property(self.as_ref(), "device-index")
253 }
254}
255
256impl<O: IsA<VulkanPhysicalDevice>> VulkanPhysicalDeviceExt for O {}