1#[doc(alias = "VK_EXT_DISPLAY_CONTROL_SPEC_VERSION")]
4pub const EXT_DISPLAY_CONTROL_SPEC_VERSION: u32 = 1;
5#[doc(alias = "VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME")]
7pub const EXT_DISPLAY_CONTROL_EXTENSION_NAME: *const std::os::raw::c_char = crate::cstr!(
8 "VK_EXT_display_control"
9);
10pub const FN_DISPLAY_POWER_CONTROL_EXT: *const std::os::raw::c_char = crate::cstr!(
12 "vkDisplayPowerControlEXT"
13);
14pub const FN_REGISTER_DEVICE_EVENT_EXT: *const std::os::raw::c_char = crate::cstr!(
16 "vkRegisterDeviceEventEXT"
17);
18pub const FN_REGISTER_DISPLAY_EVENT_EXT: *const std::os::raw::c_char = crate::cstr!(
20 "vkRegisterDisplayEventEXT"
21);
22pub const FN_GET_SWAPCHAIN_COUNTER_EXT: *const std::os::raw::c_char = crate::cstr!(
24 "vkGetSwapchainCounterEXT"
25);
26impl crate::vk1_0::StructureType {
28 pub const DISPLAY_POWER_INFO_EXT: Self = Self(1000091000);
29 pub const DEVICE_EVENT_INFO_EXT: Self = Self(1000091001);
30 pub const DISPLAY_EVENT_INFO_EXT: Self = Self(1000091002);
31 pub const SWAPCHAIN_COUNTER_CREATE_INFO_EXT: Self = Self(1000091003);
32}
33#[doc(alias = "VkDisplayPowerStateEXT")]
35#[derive(Copy, Clone, PartialEq, Eq, Hash, Default, Ord, PartialOrd)]
36#[repr(transparent)]
37pub struct DisplayPowerStateEXT(pub i32);
38impl std::fmt::Debug for DisplayPowerStateEXT {
39 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
40 f.write_str(
41 match self {
42 &Self::OFF_EXT => "OFF_EXT",
43 &Self::SUSPEND_EXT => "SUSPEND_EXT",
44 &Self::ON_EXT => "ON_EXT",
45 _ => "(unknown variant)",
46 },
47 )
48 }
49}
50impl crate::extensions::ext_display_control::DisplayPowerStateEXT {
52 pub const OFF_EXT: Self = Self(0);
53 pub const SUSPEND_EXT: Self = Self(1);
54 pub const ON_EXT: Self = Self(2);
55}
56#[doc(alias = "VkDeviceEventTypeEXT")]
58#[derive(Copy, Clone, PartialEq, Eq, Hash, Default, Ord, PartialOrd)]
59#[repr(transparent)]
60pub struct DeviceEventTypeEXT(pub i32);
61impl std::fmt::Debug for DeviceEventTypeEXT {
62 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
63 f.write_str(
64 match self {
65 &Self::DISPLAY_HOTPLUG_EXT => "DISPLAY_HOTPLUG_EXT",
66 _ => "(unknown variant)",
67 },
68 )
69 }
70}
71impl crate::extensions::ext_display_control::DeviceEventTypeEXT {
73 pub const DISPLAY_HOTPLUG_EXT: Self = Self(0);
74}
75#[doc(alias = "VkDisplayEventTypeEXT")]
77#[derive(Copy, Clone, PartialEq, Eq, Hash, Default, Ord, PartialOrd)]
78#[repr(transparent)]
79pub struct DisplayEventTypeEXT(pub i32);
80impl std::fmt::Debug for DisplayEventTypeEXT {
81 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
82 f.write_str(
83 match self {
84 &Self::FIRST_PIXEL_OUT_EXT => "FIRST_PIXEL_OUT_EXT",
85 _ => "(unknown variant)",
86 },
87 )
88 }
89}
90impl crate::extensions::ext_display_control::DisplayEventTypeEXT {
92 pub const FIRST_PIXEL_OUT_EXT: Self = Self(0);
93}
94#[allow(non_camel_case_types)]
96pub type PFN_vkDisplayPowerControlEXT = unsafe extern "system" fn(
97 device: crate::vk1_0::Device,
98 display: crate::extensions::khr_display::DisplayKHR,
99 p_display_power_info: *const crate::extensions::ext_display_control::DisplayPowerInfoEXT,
100) -> crate::vk1_0::Result;
101#[allow(non_camel_case_types)]
103pub type PFN_vkRegisterDeviceEventEXT = unsafe extern "system" fn(
104 device: crate::vk1_0::Device,
105 p_device_event_info: *const crate::extensions::ext_display_control::DeviceEventInfoEXT,
106 p_allocator: *const crate::vk1_0::AllocationCallbacks,
107 p_fence: *mut crate::vk1_0::Fence,
108) -> crate::vk1_0::Result;
109#[allow(non_camel_case_types)]
111pub type PFN_vkRegisterDisplayEventEXT = unsafe extern "system" fn(
112 device: crate::vk1_0::Device,
113 display: crate::extensions::khr_display::DisplayKHR,
114 p_display_event_info: *const crate::extensions::ext_display_control::DisplayEventInfoEXT,
115 p_allocator: *const crate::vk1_0::AllocationCallbacks,
116 p_fence: *mut crate::vk1_0::Fence,
117) -> crate::vk1_0::Result;
118#[allow(non_camel_case_types)]
120pub type PFN_vkGetSwapchainCounterEXT = unsafe extern "system" fn(
121 device: crate::vk1_0::Device,
122 swapchain: crate::extensions::khr_swapchain::SwapchainKHR,
123 counter: crate::extensions::ext_display_surface_counter::SurfaceCounterFlagBitsEXT,
124 p_counter_value: *mut u64,
125) -> crate::vk1_0::Result;
126impl<'a> crate::ExtendableFrom<'a, SwapchainCounterCreateInfoEXT>
127for crate::extensions::khr_swapchain::SwapchainCreateInfoKHRBuilder<'a> {}
128impl<'a> crate::ExtendableFrom<'a, SwapchainCounterCreateInfoEXTBuilder<'_>>
129for crate::extensions::khr_swapchain::SwapchainCreateInfoKHRBuilder<'a> {}
130#[doc(alias = "VkDisplayPowerInfoEXT")]
132#[derive(Copy, Clone)]
133#[repr(C)]
134pub struct DisplayPowerInfoEXT {
135 pub s_type: crate::vk1_0::StructureType,
136 pub p_next: *const std::ffi::c_void,
137 pub power_state: crate::extensions::ext_display_control::DisplayPowerStateEXT,
138}
139impl DisplayPowerInfoEXT {
140 pub const STRUCTURE_TYPE: crate::vk1_0::StructureType = crate::vk1_0::StructureType::DISPLAY_POWER_INFO_EXT;
141}
142impl Default for DisplayPowerInfoEXT {
143 fn default() -> Self {
144 Self {
145 s_type: Self::STRUCTURE_TYPE,
146 p_next: std::ptr::null(),
147 power_state: Default::default(),
148 }
149 }
150}
151impl std::fmt::Debug for DisplayPowerInfoEXT {
152 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
153 f.debug_struct("DisplayPowerInfoEXT")
154 .field("s_type", &self.s_type)
155 .field("p_next", &self.p_next)
156 .field("power_state", &self.power_state)
157 .finish()
158 }
159}
160impl DisplayPowerInfoEXT {
161 #[inline]
162 pub fn into_builder<'a>(self) -> DisplayPowerInfoEXTBuilder<'a> {
163 DisplayPowerInfoEXTBuilder(self, std::marker::PhantomData)
164 }
165}
166#[derive(Copy, Clone)]
167#[repr(transparent)]
169pub struct DisplayPowerInfoEXTBuilder<'a>(
170 DisplayPowerInfoEXT,
171 std::marker::PhantomData<&'a ()>,
172);
173impl<'a> DisplayPowerInfoEXTBuilder<'a> {
174 #[inline]
175 pub fn new() -> DisplayPowerInfoEXTBuilder<'a> {
176 DisplayPowerInfoEXTBuilder(Default::default(), std::marker::PhantomData)
177 }
178 #[inline]
179 #[must_use]
180 pub fn power_state(
181 mut self,
182 power_state: crate::extensions::ext_display_control::DisplayPowerStateEXT,
183 ) -> Self {
184 self.0.power_state = power_state as _;
185 self
186 }
187 #[inline]
188 pub fn build_dangling(self) -> DisplayPowerInfoEXT {
191 self.0
192 }
193}
194impl<'a> std::default::Default for DisplayPowerInfoEXTBuilder<'a> {
195 fn default() -> DisplayPowerInfoEXTBuilder<'a> {
196 Self::new()
197 }
198}
199impl<'a> std::fmt::Debug for DisplayPowerInfoEXTBuilder<'a> {
200 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
201 std::fmt::Debug::fmt(&self.0, f)
202 }
203}
204impl<'a> std::ops::Deref for DisplayPowerInfoEXTBuilder<'a> {
205 type Target = DisplayPowerInfoEXT;
206 fn deref(&self) -> &Self::Target {
207 &self.0
208 }
209}
210impl<'a> std::ops::DerefMut for DisplayPowerInfoEXTBuilder<'a> {
211 fn deref_mut(&mut self) -> &mut Self::Target {
212 &mut self.0
213 }
214}
215#[doc(alias = "VkDeviceEventInfoEXT")]
217#[derive(Copy, Clone)]
218#[repr(C)]
219pub struct DeviceEventInfoEXT {
220 pub s_type: crate::vk1_0::StructureType,
221 pub p_next: *const std::ffi::c_void,
222 pub device_event: crate::extensions::ext_display_control::DeviceEventTypeEXT,
223}
224impl DeviceEventInfoEXT {
225 pub const STRUCTURE_TYPE: crate::vk1_0::StructureType = crate::vk1_0::StructureType::DEVICE_EVENT_INFO_EXT;
226}
227impl Default for DeviceEventInfoEXT {
228 fn default() -> Self {
229 Self {
230 s_type: Self::STRUCTURE_TYPE,
231 p_next: std::ptr::null(),
232 device_event: Default::default(),
233 }
234 }
235}
236impl std::fmt::Debug for DeviceEventInfoEXT {
237 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
238 f.debug_struct("DeviceEventInfoEXT")
239 .field("s_type", &self.s_type)
240 .field("p_next", &self.p_next)
241 .field("device_event", &self.device_event)
242 .finish()
243 }
244}
245impl DeviceEventInfoEXT {
246 #[inline]
247 pub fn into_builder<'a>(self) -> DeviceEventInfoEXTBuilder<'a> {
248 DeviceEventInfoEXTBuilder(self, std::marker::PhantomData)
249 }
250}
251#[derive(Copy, Clone)]
252#[repr(transparent)]
254pub struct DeviceEventInfoEXTBuilder<'a>(
255 DeviceEventInfoEXT,
256 std::marker::PhantomData<&'a ()>,
257);
258impl<'a> DeviceEventInfoEXTBuilder<'a> {
259 #[inline]
260 pub fn new() -> DeviceEventInfoEXTBuilder<'a> {
261 DeviceEventInfoEXTBuilder(Default::default(), std::marker::PhantomData)
262 }
263 #[inline]
264 #[must_use]
265 pub fn device_event(
266 mut self,
267 device_event: crate::extensions::ext_display_control::DeviceEventTypeEXT,
268 ) -> Self {
269 self.0.device_event = device_event as _;
270 self
271 }
272 #[inline]
273 pub fn build_dangling(self) -> DeviceEventInfoEXT {
276 self.0
277 }
278}
279impl<'a> std::default::Default for DeviceEventInfoEXTBuilder<'a> {
280 fn default() -> DeviceEventInfoEXTBuilder<'a> {
281 Self::new()
282 }
283}
284impl<'a> std::fmt::Debug for DeviceEventInfoEXTBuilder<'a> {
285 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
286 std::fmt::Debug::fmt(&self.0, f)
287 }
288}
289impl<'a> std::ops::Deref for DeviceEventInfoEXTBuilder<'a> {
290 type Target = DeviceEventInfoEXT;
291 fn deref(&self) -> &Self::Target {
292 &self.0
293 }
294}
295impl<'a> std::ops::DerefMut for DeviceEventInfoEXTBuilder<'a> {
296 fn deref_mut(&mut self) -> &mut Self::Target {
297 &mut self.0
298 }
299}
300#[doc(alias = "VkDisplayEventInfoEXT")]
302#[derive(Copy, Clone)]
303#[repr(C)]
304pub struct DisplayEventInfoEXT {
305 pub s_type: crate::vk1_0::StructureType,
306 pub p_next: *const std::ffi::c_void,
307 pub display_event: crate::extensions::ext_display_control::DisplayEventTypeEXT,
308}
309impl DisplayEventInfoEXT {
310 pub const STRUCTURE_TYPE: crate::vk1_0::StructureType = crate::vk1_0::StructureType::DISPLAY_EVENT_INFO_EXT;
311}
312impl Default for DisplayEventInfoEXT {
313 fn default() -> Self {
314 Self {
315 s_type: Self::STRUCTURE_TYPE,
316 p_next: std::ptr::null(),
317 display_event: Default::default(),
318 }
319 }
320}
321impl std::fmt::Debug for DisplayEventInfoEXT {
322 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
323 f.debug_struct("DisplayEventInfoEXT")
324 .field("s_type", &self.s_type)
325 .field("p_next", &self.p_next)
326 .field("display_event", &self.display_event)
327 .finish()
328 }
329}
330impl DisplayEventInfoEXT {
331 #[inline]
332 pub fn into_builder<'a>(self) -> DisplayEventInfoEXTBuilder<'a> {
333 DisplayEventInfoEXTBuilder(self, std::marker::PhantomData)
334 }
335}
336#[derive(Copy, Clone)]
337#[repr(transparent)]
339pub struct DisplayEventInfoEXTBuilder<'a>(
340 DisplayEventInfoEXT,
341 std::marker::PhantomData<&'a ()>,
342);
343impl<'a> DisplayEventInfoEXTBuilder<'a> {
344 #[inline]
345 pub fn new() -> DisplayEventInfoEXTBuilder<'a> {
346 DisplayEventInfoEXTBuilder(Default::default(), std::marker::PhantomData)
347 }
348 #[inline]
349 #[must_use]
350 pub fn display_event(
351 mut self,
352 display_event: crate::extensions::ext_display_control::DisplayEventTypeEXT,
353 ) -> Self {
354 self.0.display_event = display_event as _;
355 self
356 }
357 #[inline]
358 pub fn build_dangling(self) -> DisplayEventInfoEXT {
361 self.0
362 }
363}
364impl<'a> std::default::Default for DisplayEventInfoEXTBuilder<'a> {
365 fn default() -> DisplayEventInfoEXTBuilder<'a> {
366 Self::new()
367 }
368}
369impl<'a> std::fmt::Debug for DisplayEventInfoEXTBuilder<'a> {
370 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
371 std::fmt::Debug::fmt(&self.0, f)
372 }
373}
374impl<'a> std::ops::Deref for DisplayEventInfoEXTBuilder<'a> {
375 type Target = DisplayEventInfoEXT;
376 fn deref(&self) -> &Self::Target {
377 &self.0
378 }
379}
380impl<'a> std::ops::DerefMut for DisplayEventInfoEXTBuilder<'a> {
381 fn deref_mut(&mut self) -> &mut Self::Target {
382 &mut self.0
383 }
384}
385#[doc(alias = "VkSwapchainCounterCreateInfoEXT")]
387#[derive(Copy, Clone)]
388#[repr(C)]
389pub struct SwapchainCounterCreateInfoEXT {
390 pub s_type: crate::vk1_0::StructureType,
391 pub p_next: *const std::ffi::c_void,
392 pub surface_counters: crate::extensions::ext_display_surface_counter::SurfaceCounterFlagsEXT,
393}
394impl SwapchainCounterCreateInfoEXT {
395 pub const STRUCTURE_TYPE: crate::vk1_0::StructureType = crate::vk1_0::StructureType::SWAPCHAIN_COUNTER_CREATE_INFO_EXT;
396}
397impl Default for SwapchainCounterCreateInfoEXT {
398 fn default() -> Self {
399 Self {
400 s_type: Self::STRUCTURE_TYPE,
401 p_next: std::ptr::null(),
402 surface_counters: Default::default(),
403 }
404 }
405}
406impl std::fmt::Debug for SwapchainCounterCreateInfoEXT {
407 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
408 f.debug_struct("SwapchainCounterCreateInfoEXT")
409 .field("s_type", &self.s_type)
410 .field("p_next", &self.p_next)
411 .field("surface_counters", &self.surface_counters)
412 .finish()
413 }
414}
415impl SwapchainCounterCreateInfoEXT {
416 #[inline]
417 pub fn into_builder<'a>(self) -> SwapchainCounterCreateInfoEXTBuilder<'a> {
418 SwapchainCounterCreateInfoEXTBuilder(self, std::marker::PhantomData)
419 }
420}
421#[derive(Copy, Clone)]
422#[repr(transparent)]
424pub struct SwapchainCounterCreateInfoEXTBuilder<'a>(
425 SwapchainCounterCreateInfoEXT,
426 std::marker::PhantomData<&'a ()>,
427);
428impl<'a> SwapchainCounterCreateInfoEXTBuilder<'a> {
429 #[inline]
430 pub fn new() -> SwapchainCounterCreateInfoEXTBuilder<'a> {
431 SwapchainCounterCreateInfoEXTBuilder(
432 Default::default(),
433 std::marker::PhantomData,
434 )
435 }
436 #[inline]
437 #[must_use]
438 pub fn surface_counters(
439 mut self,
440 surface_counters: crate::extensions::ext_display_surface_counter::SurfaceCounterFlagsEXT,
441 ) -> Self {
442 self.0.surface_counters = surface_counters as _;
443 self
444 }
445 #[inline]
446 pub fn build_dangling(self) -> SwapchainCounterCreateInfoEXT {
449 self.0
450 }
451}
452impl<'a> std::default::Default for SwapchainCounterCreateInfoEXTBuilder<'a> {
453 fn default() -> SwapchainCounterCreateInfoEXTBuilder<'a> {
454 Self::new()
455 }
456}
457impl<'a> std::fmt::Debug for SwapchainCounterCreateInfoEXTBuilder<'a> {
458 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
459 std::fmt::Debug::fmt(&self.0, f)
460 }
461}
462impl<'a> std::ops::Deref for SwapchainCounterCreateInfoEXTBuilder<'a> {
463 type Target = SwapchainCounterCreateInfoEXT;
464 fn deref(&self) -> &Self::Target {
465 &self.0
466 }
467}
468impl<'a> std::ops::DerefMut for SwapchainCounterCreateInfoEXTBuilder<'a> {
469 fn deref_mut(&mut self) -> &mut Self::Target {
470 &mut self.0
471 }
472}
473impl crate::DeviceLoader {
475 #[inline]
476 #[track_caller]
477 #[doc(alias = "vkDisplayPowerControlEXT")]
479 pub unsafe fn display_power_control_ext(
480 &self,
481 display: crate::extensions::khr_display::DisplayKHR,
482 display_power_info: &crate::extensions::ext_display_control::DisplayPowerInfoEXT,
483 ) -> crate::utils::VulkanResult<()> {
484 let _function = self.display_power_control_ext.expect(crate::NOT_LOADED_MESSAGE);
485 let _return = _function(self.handle, display as _, display_power_info as _);
486 crate::utils::VulkanResult::new(_return, ())
487 }
488 #[inline]
489 #[track_caller]
490 #[doc(alias = "vkRegisterDeviceEventEXT")]
492 pub unsafe fn register_device_event_ext(
493 &self,
494 device_event_info: &crate::extensions::ext_display_control::DeviceEventInfoEXT,
495 allocator: Option<&crate::vk1_0::AllocationCallbacks>,
496 ) -> crate::utils::VulkanResult<crate::vk1_0::Fence> {
497 let _function = self.register_device_event_ext.expect(crate::NOT_LOADED_MESSAGE);
498 let mut fence = Default::default();
499 let _return = _function(
500 self.handle,
501 device_event_info as _,
502 match allocator {
503 Some(v) => v,
504 None => std::ptr::null(),
505 },
506 &mut fence,
507 );
508 crate::utils::VulkanResult::new(_return, fence)
509 }
510 #[inline]
511 #[track_caller]
512 #[doc(alias = "vkRegisterDisplayEventEXT")]
514 pub unsafe fn register_display_event_ext(
515 &self,
516 display: crate::extensions::khr_display::DisplayKHR,
517 display_event_info: &crate::extensions::ext_display_control::DisplayEventInfoEXT,
518 allocator: Option<&crate::vk1_0::AllocationCallbacks>,
519 ) -> crate::utils::VulkanResult<crate::vk1_0::Fence> {
520 let _function = self
521 .register_display_event_ext
522 .expect(crate::NOT_LOADED_MESSAGE);
523 let mut fence = Default::default();
524 let _return = _function(
525 self.handle,
526 display as _,
527 display_event_info as _,
528 match allocator {
529 Some(v) => v,
530 None => std::ptr::null(),
531 },
532 &mut fence,
533 );
534 crate::utils::VulkanResult::new(_return, fence)
535 }
536 #[inline]
537 #[track_caller]
538 #[doc(alias = "vkGetSwapchainCounterEXT")]
540 pub unsafe fn get_swapchain_counter_ext(
541 &self,
542 swapchain: crate::extensions::khr_swapchain::SwapchainKHR,
543 counter: crate::extensions::ext_display_surface_counter::SurfaceCounterFlagBitsEXT,
544 ) -> crate::utils::VulkanResult<u64> {
545 let _function = self.get_swapchain_counter_ext.expect(crate::NOT_LOADED_MESSAGE);
546 let mut counter_value = Default::default();
547 let _return = _function(
548 self.handle,
549 swapchain as _,
550 counter as _,
551 &mut counter_value,
552 );
553 crate::utils::VulkanResult::new(_return, counter_value)
554 }
555}