1use bedrock_vk as brvk;
2
3use crate::{error::translate_vk_result, *};
4use core::{ffi::CStr, mem::MaybeUninit, ptr::null_mut};
5use ffi_helper::{opt_cstr_ptr, opt_pointer};
6
7#[inline]
8pub fn instance_layer_property_count() -> crate::Result<u32> {
9 let mut n = 0;
10 translate_vk_result(unsafe { brvk::fns::enumerate_instance_layer_properties(&mut n, null_mut()) })?;
11
12 Ok(n)
13}
14
15#[inline]
16pub fn instance_layer_properties(
17 sink: &mut [MaybeUninit<brvk::VkLayerProperties>],
18) -> crate::Result<ArrayQueryResult<u32>> {
19 let mut n = sink.len() as _;
20 let r = ArrayQueryResult::from_vk_result(unsafe {
21 brvk::fns::enumerate_instance_layer_properties(&mut n, sink.as_mut_ptr().cast())
22 })?;
23
24 Ok(r.with_result(n))
25}
26
27#[inline]
28pub fn instance_extension_property_count(layer_name: Option<&CStr>) -> crate::Result<u32> {
29 let mut n = 0;
30 translate_vk_result(unsafe {
31 brvk::fns::enumerate_instance_extension_properties(opt_cstr_ptr(layer_name), &mut n, null_mut())
32 })?;
33
34 Ok(n)
35}
36
37#[inline]
38pub fn instance_extension_properties(
39 layer_name: Option<&CStr>,
40 sink: &mut [MaybeUninit<brvk::VkExtensionProperties>],
41) -> crate::Result<ArrayQueryResult<u32>> {
42 let mut n = sink.len() as _;
43 let r = ArrayQueryResult::from_vk_result(unsafe {
44 brvk::fns::enumerate_instance_extension_properties(opt_cstr_ptr(layer_name), &mut n, sink.as_mut_ptr().cast())
45 })?;
46
47 Ok(r.with_result(n))
48}
49
50#[inline]
51pub fn create_instance(
52 info: &InstanceCreateInfo,
53 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
54) -> crate::Result<brvk::VkInstance> {
55 let mut h = core::mem::MaybeUninit::uninit();
56 translate_vk_result(unsafe {
57 brvk::fns::create_instance(
58 core::ptr::from_ref(info).cast(),
59 opt_pointer(allocation_callbacks),
60 h.as_mut_ptr(),
61 )
62 })?;
63
64 Ok(unsafe { h.assume_init() })
65}
66
67#[inline(always)]
68pub fn destroy_instance(
69 instance: VkHandleRefMut<brvk::VkInstance>,
70 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
71) {
72 unsafe { brvk::fns::destroy_instance(instance.0, opt_pointer(allocation_callbacks)) }
73}
74
75#[inline]
76pub fn physical_device_count(instance: VkHandleRef<brvk::VkInstance>) -> crate::Result<u32> {
77 let mut n = 0;
78 translate_vk_result(unsafe { brvk::fns::enumerate_physical_devices(instance.0, &mut n, null_mut()) })?;
79
80 Ok(n)
81}
82
83#[inline]
84pub fn enumerate_physical_devices(
85 instance: VkHandleRef<brvk::VkInstance>,
86 sink: &mut [MaybeUninit<brvk::VkPhysicalDevice>],
87) -> crate::Result<ArrayQueryResult<u32>> {
88 let mut n = sink.len() as _;
89 let r = ArrayQueryResult::from_vk_result(unsafe {
90 brvk::fns::enumerate_physical_devices(instance.0, &mut n, sink.as_mut_ptr().cast())
91 })?;
92
93 Ok(r.with_result(n))
94}
95
96#[inline]
97pub fn device_layer_property_count(physical_device: VkHandleRef<brvk::VkPhysicalDevice>) -> crate::Result<u32> {
98 let mut sink = MaybeUninit::uninit();
99 translate_vk_result(unsafe {
100 brvk::fns::enumerate_device_layer_properties(physical_device.0, sink.as_mut_ptr(), null_mut())
101 })?;
102
103 Ok(unsafe { sink.assume_init() })
104}
105
106#[inline]
107pub fn enumerate_device_layer_properties(
108 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
109 sink: &mut [MaybeUninit<brvk::VkLayerProperties>],
110) -> crate::Result<ArrayQueryResult<u32>> {
111 let mut n = sink.len() as _;
112 let r = ArrayQueryResult::from_vk_result(unsafe {
113 brvk::fns::enumerate_device_layer_properties(physical_device.0, &mut n, sink.as_mut_ptr().cast())
114 })?;
115
116 Ok(r.with_result(n))
117}
118
119#[inline]
120pub fn device_extension_property_count(
121 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
122 layer_name: Option<&CStr>,
123) -> crate::Result<u32> {
124 let mut sink = MaybeUninit::uninit();
125 translate_vk_result(unsafe {
126 brvk::fns::enumerate_device_extension_properties(
127 physical_device.0,
128 opt_cstr_ptr(layer_name),
129 sink.as_mut_ptr(),
130 null_mut(),
131 )
132 })?;
133
134 Ok(unsafe { sink.assume_init() })
135}
136
137#[inline]
138pub fn enumerate_device_extension_properties(
139 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
140 layer_name: Option<&CStr>,
141 sink: &mut [MaybeUninit<brvk::VkExtensionProperties>],
142) -> crate::Result<ArrayQueryResult<u32>> {
143 let mut n = sink.len() as _;
144 let r = ArrayQueryResult::from_vk_result(unsafe {
145 brvk::fns::enumerate_device_extension_properties(
146 physical_device.0,
147 opt_cstr_ptr(layer_name),
148 &mut n,
149 sink.as_mut_ptr().cast(),
150 )
151 })?;
152
153 Ok(r.with_result(n))
154}
155
156#[inline(always)]
157pub fn get_physical_device_features(
158 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
159 sink: &mut MaybeUninit<PhysicalDeviceFeatures>,
160) {
161 unsafe { brvk::fns::get_physical_device_features(physical_device.0, sink.as_mut_ptr()) }
162}
163
164#[cfg(feature = "Allow1_1APIs")]
165#[inline(always)]
166pub fn get_physical_device_features2(
167 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
168 sink: &mut MaybeUninit<PhysicalDeviceFeatures2>,
169) {
170 unsafe { brvk::fns::get_physical_device_features2(physical_device.0, sink.as_mut_ptr().cast()) }
171}
172
173#[inline(always)]
174pub fn get_physical_device_properties(
175 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
176 sink: &mut MaybeUninit<PhysicalDeviceProperties>,
177) {
178 unsafe { brvk::fns::get_physical_device_properties(physical_device.0, sink.as_mut_ptr()) }
179}
180
181#[cfg(feature = "Allow1_1APIs")]
182#[inline(always)]
183pub fn get_physical_device_properties2(
184 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
185 sink: &mut MaybeUninit<brvk::VkPhysicalDeviceProperties2>,
186) {
187 unsafe { brvk::fns::get_physical_device_properties2(physical_device.0, sink.as_mut_ptr()) }
188}
189
190#[inline(always)]
191pub fn get_physical_device_memory_properties(
192 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
193 sink: &mut MaybeUninit<PhysicalDeviceMemoryProperties>,
194) {
195 unsafe { brvk::fns::get_physical_device_memory_properties(physical_device.0, sink.as_mut_ptr().cast()) }
196}
197
198#[inline(always)]
199pub fn get_physical_device_format_properties(
200 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
201 format: brvk::VkFormat,
202 sink: &mut MaybeUninit<brvk::VkFormatProperties>,
203) {
204 unsafe { brvk::fns::get_physical_device_format_properties(physical_device.0, format, sink.as_mut_ptr()) }
205}
206
207#[cfg(feature = "Allow1_1APIs")]
208#[inline(always)]
209pub fn get_physical_device_format_properties2(
210 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
211 format: brvk::VkFormat,
212 sink: &mut MaybeUninit<brvk::VkFormatProperties2>,
213) {
214 unsafe { brvk::fns::get_physical_device_format_properties2(physical_device.0, format, sink.as_mut_ptr()) }
215}
216
217#[inline(always)]
218pub fn get_physical_device_image_format_properties(
219 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
220 format: brvk::VkFormat,
221 image_type: brvk::VkImageType,
222 tiling: brvk::VkImageTiling,
223 usage: ImageUsageFlags,
224 flags: ImageFlags,
225 sink: &mut MaybeUninit<brvk::VkImageFormatProperties>,
226) -> crate::Result<()> {
227 translate_vk_result(unsafe {
228 brvk::fns::get_physical_device_image_format_properties(
229 physical_device.0,
230 format,
231 image_type,
232 tiling,
233 usage.bits(),
234 flags.bits(),
235 sink.as_mut_ptr(),
236 )
237 })?;
238
239 Ok(())
240}
241
242#[cfg(feature = "Allow1_1APIs")]
243#[inline(always)]
244pub fn get_physical_device_image_format_properties2(
245 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
246 info: &brvk::VkPhysicalDeviceImageFormatInfo2,
247 sink: &mut MaybeUninit<brvk::VkImageFormatProperties2>,
248) -> crate::Result<()> {
249 translate_vk_result(unsafe {
250 brvk::fns::get_physical_device_image_format_properties2(
251 physical_device.0,
252 core::ptr::from_ref(info),
253 sink.as_mut_ptr(),
254 )
255 })?;
256
257 Ok(())
258}
259
260#[inline]
261pub fn get_physical_device_sparse_image_format_property_count(
262 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
263 format: brvk::VkFormat,
264 image_type: brvk::VkImageType,
265 samples: brvk::VkSampleCountFlags,
266 usage: ImageUsageFlags,
267 tiling: brvk::VkImageTiling,
268) -> u32 {
269 let mut sink = MaybeUninit::uninit();
270 unsafe {
271 brvk::fns::get_physical_device_sparse_image_format_properties(
272 physical_device.0,
273 format,
274 image_type,
275 samples,
276 usage.bits(),
277 tiling,
278 sink.as_mut_ptr(),
279 null_mut(),
280 );
281 }
282
283 unsafe { sink.assume_init() }
284}
285
286#[inline]
287pub fn get_physical_device_sparse_image_format_properties(
288 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
289 format: brvk::VkFormat,
290 image_type: brvk::VkImageType,
291 samples: brvk::VkSampleCountFlags,
292 usage: ImageUsageFlags,
293 tiling: brvk::VkImageTiling,
294 sink: &mut [MaybeUninit<brvk::VkSparseImageFormatProperties>],
295) -> u32 {
296 let mut count = sink.len() as _;
297 unsafe {
298 brvk::fns::get_physical_device_sparse_image_format_properties(
299 physical_device.0,
300 format,
301 image_type,
302 samples,
303 usage.bits(),
304 tiling,
305 &mut count,
306 sink.as_mut_ptr().cast(),
307 );
308 }
309
310 count
311}
312
313#[inline]
314pub fn get_physical_device_queue_family_property_count(physical_device: VkHandleRef<brvk::VkPhysicalDevice>) -> u32 {
315 let mut sink = MaybeUninit::uninit();
316 unsafe {
317 brvk::fns::get_physical_device_queue_family_properties(physical_device.0, sink.as_mut_ptr(), null_mut());
318 }
319
320 unsafe { sink.assume_init() }
321}
322
323#[inline(always)]
324pub fn get_physical_device_queue_family_properties(
325 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
326 sink: &mut [MaybeUninit<QueueFamilyProperties>],
327) -> u32 {
328 let mut count = sink.len() as _;
329 unsafe {
330 brvk::fns::get_physical_device_queue_family_properties(physical_device.0, &mut count, sink.as_mut_ptr().cast());
331 }
332
333 count
334}
335
336#[cfg(feature = "VK_KHR_xlib_surface")]
340#[inline]
341pub unsafe fn get_physical_device_xlib_presentation_support(
342 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
343 queue_family_index: u32,
344 dpy: *mut x11::xlib::Display,
345 visual_id: x11::xlib::VisualID,
346) -> bool {
347 unsafe {
348 brvk::fns::get_physical_device_xlib_presentation_support_khr(
349 physical_device.0,
350 queue_family_index,
351 dpy,
352 visual_id,
353 ) == brvk::VK_TRUE
354 }
355}
356
357#[cfg(feature = "VK_KHR_xcb_surface")]
361#[inline]
362pub unsafe fn get_physical_device_xcb_presentation_support(
363 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
364 queue_family_index: u32,
365 connection: *mut xcb::ffi::xcb_connection_t,
366 visual_id: xcb::x::Visualid,
367) -> bool {
368 unsafe {
369 brvk::fns::get_physical_device_xcb_presentation_support_khr(
370 physical_device.0,
371 queue_family_index,
372 connection,
373 visual_id,
374 ) == brvk::VK_TRUE
375 }
376}
377
378#[cfg(feature = "VK_KHR_wayland_surface")]
382#[inline]
383pub unsafe fn get_physical_device_wayland_presentation_support(
384 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
385 queue_family_index: u32,
386 display: *mut core::ffi::c_void,
387) -> bool {
388 unsafe {
389 brvk::fns::get_physical_device_wayland_presentation_support_khr(physical_device.0, queue_family_index, display)
390 == brvk::VK_TRUE
391 }
392}
393
394#[cfg(feature = "VK_KHR_win32_surface")]
395#[inline(always)]
396pub fn get_physical_device_win32_presentation_support(
397 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
398 queue_family_index: u32,
399) -> bool {
400 unsafe {
401 brvk::fns::get_physical_device_win32_presentation_support_khr(physical_device.0, queue_family_index)
402 == brvk::VK_TRUE
403 }
404}
405
406#[cfg(feature = "VK_KHR_surface")]
410#[inline]
411pub unsafe fn get_physical_device_surface_support(
412 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
413 queue_family_index: u32,
414 surface: VkHandleRef<brvk::VkSurfaceKHR>,
415) -> crate::Result<bool> {
416 let mut sink = MaybeUninit::uninit();
417 translate_vk_result(unsafe {
418 brvk::fns::get_physical_device_surface_support_khr(
419 physical_device.0,
420 queue_family_index,
421 surface.0,
422 sink.as_mut_ptr(),
423 )
424 })?;
425
426 Ok(unsafe { sink.assume_init() == brvk::VK_TRUE })
427}
428
429#[cfg(feature = "VK_KHR_surface")]
433#[inline]
434pub unsafe fn get_physical_device_surface_capabilities(
435 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
436 surface: VkHandleRef<brvk::VkSurfaceKHR>,
437 sink: &mut MaybeUninit<SurfaceCapabilities>,
438) -> crate::Result<()> {
439 translate_vk_result(unsafe {
440 brvk::fns::get_physical_device_surface_capabilities_khr(physical_device.0, surface.0, sink.as_mut_ptr().cast())
441 })?;
442
443 Ok(())
444}
445
446#[cfg(feature = "VK_KHR_surface")]
450#[inline]
451pub unsafe fn get_physical_device_surface_format_count(
452 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
453 surface: VkHandleRef<brvk::VkSurfaceKHR>,
454) -> crate::Result<u32> {
455 let mut v = MaybeUninit::uninit();
456 translate_vk_result(unsafe {
457 brvk::fns::get_physical_device_surface_formats_khr(
458 physical_device.0,
459 surface.0,
460 v.as_mut_ptr(),
461 core::ptr::null_mut(),
462 )
463 })?;
464
465 Ok(unsafe { v.assume_init() })
466}
467
468#[cfg(feature = "VK_KHR_surface")]
472#[inline]
473pub unsafe fn get_physical_device_surface_formats(
474 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
475 surface: VkHandleRef<brvk::VkSurfaceKHR>,
476 sink: &mut [MaybeUninit<SurfaceFormat>],
477) -> crate::Result<ArrayQueryResult<u32>> {
478 let mut v = sink.len() as _;
479 let r = ArrayQueryResult::from_vk_result(unsafe {
480 brvk::fns::get_physical_device_surface_formats_khr(
481 physical_device.0,
482 surface.0,
483 &mut v,
484 sink.as_mut_ptr().cast(),
485 )
486 })?;
487
488 Ok(r.with_result(v))
489}
490
491#[cfg(feature = "VK_KHR_surface")]
495#[inline]
496pub unsafe fn get_physical_device_surface_present_mode_count(
497 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
498 surface: VkHandleRef<brvk::VkSurfaceKHR>,
499) -> crate::Result<u32> {
500 let mut v = MaybeUninit::uninit();
501 translate_vk_result(unsafe {
502 brvk::fns::get_physical_device_surface_present_modes_khr(
503 physical_device.0,
504 surface.0,
505 v.as_mut_ptr(),
506 core::ptr::null_mut(),
507 )
508 })?;
509
510 Ok(unsafe { v.assume_init() })
511}
512
513#[cfg(feature = "VK_KHR_surface")]
517#[inline]
518pub unsafe fn get_physical_device_surface_present_modes(
519 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
520 surface: VkHandleRef<brvk::VkSurfaceKHR>,
521 sink: &mut [MaybeUninit<PresentMode>],
522) -> crate::Result<ArrayQueryResult<u32>> {
523 let mut v = sink.len() as _;
524 let r = ArrayQueryResult::from_vk_result(unsafe {
525 brvk::fns::get_physical_device_surface_present_modes_khr(
526 physical_device.0,
527 surface.0,
528 &mut v,
529 sink.as_mut_ptr().cast(),
530 )
531 })?;
532
533 Ok(r.with_result(v))
534}
535
536#[cfg(feature = "VK_KHR_display")]
537#[inline]
538pub fn get_physical_device_display_property_count(
539 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
540) -> crate::Result<u32> {
541 let mut count = MaybeUninit::uninit();
542 translate_vk_result(unsafe {
543 brvk::fns::get_physical_device_display_properties_khr(physical_device.0, count.as_mut_ptr(), null_mut())
544 })?;
545
546 Ok(unsafe { count.assume_init() })
547}
548
549#[cfg(feature = "VK_KHR_display")]
550#[inline]
551pub fn get_physical_device_display_properties(
552 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
553 sink: &mut [MaybeUninit<DisplayProperties>],
554) -> crate::Result<ArrayQueryResult<u32>> {
555 let mut v = sink.len() as _;
556 let r = ArrayQueryResult::from_vk_result(unsafe {
557 brvk::fns::get_physical_device_display_properties_khr(physical_device.0, &mut v, sink.as_mut_ptr().cast())
558 })?;
559
560 Ok(r.with_result(v))
561}
562
563#[cfg(feature = "VK_KHR_display")]
564#[inline]
565pub fn get_physical_device_display_plane_property_count(
566 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
567) -> crate::Result<u32> {
568 let mut count = MaybeUninit::uninit();
569 translate_vk_result(unsafe {
570 brvk::fns::get_physical_device_display_plane_properties_khr(physical_device.0, count.as_mut_ptr(), null_mut())
571 })?;
572
573 Ok(unsafe { count.assume_init() })
574}
575
576#[cfg(feature = "VK_KHR_display")]
577#[inline]
578pub fn get_physical_device_display_plane_properties(
579 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
580 sink: &mut [MaybeUninit<DisplayPlaneProperties>],
581) -> crate::Result<ArrayQueryResult<u32>> {
582 let mut v = sink.len() as _;
583 let r = ArrayQueryResult::from_vk_result(unsafe {
584 brvk::fns::get_physical_device_display_plane_properties_khr(physical_device.0, &mut v, sink.as_mut_ptr().cast())
585 })?;
586
587 Ok(r.with_result(v))
588}
589
590#[cfg(feature = "VK_KHR_display")]
594#[inline]
595pub unsafe fn get_display_mode_property_count(
596 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
597 display: VkHandleRef<brvk::VkDisplayKHR>,
598) -> crate::Result<u32> {
599 let mut count = MaybeUninit::uninit();
600 translate_vk_result(unsafe {
601 brvk::fns::get_display_mode_properties_khr(physical_device.0, display.0, count.as_mut_ptr(), null_mut())
602 })?;
603
604 Ok(unsafe { count.assume_init() })
605}
606
607#[cfg(feature = "VK_KHR_display")]
611#[inline]
612pub unsafe fn get_display_mode_properties(
613 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
614 display: VkHandleRef<brvk::VkDisplayKHR>,
615 sink: &mut [MaybeUninit<DisplayModeProperties>],
616) -> crate::Result<ArrayQueryResult<u32>> {
617 let mut v = sink.len() as _;
618 let r = ArrayQueryResult::from_vk_result(unsafe {
619 brvk::fns::get_display_mode_properties_khr(physical_device.0, display.0, &mut v, sink.as_mut_ptr().cast())
620 })?;
621
622 Ok(r.with_result(v))
623}
624
625#[cfg(feature = "VK_KHR_display")]
629#[inline]
630pub unsafe fn get_display_plane_capabilities(
631 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
632 mode: VkHandleRefMut<brvk::VkDisplayModeKHR>,
633 plane_index: u32,
634 sink: &mut MaybeUninit<brvk::VkDisplayPlaneCapabilitiesKHR>,
635) -> crate::Result<()> {
636 translate_vk_result(unsafe {
637 brvk::fns::get_display_plane_capabilities_khr(physical_device.0, mode.0, plane_index, sink.as_mut_ptr())
638 })?;
639
640 Ok(())
641}
642
643#[cfg(feature = "VK_KHR_display")]
644#[inline]
645pub fn get_display_plane_supported_display_count(
646 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
647 plane_index: u32,
648) -> crate::Result<u32> {
649 let mut count = MaybeUninit::uninit();
650 translate_vk_result(unsafe {
651 brvk::fns::get_display_plane_supported_displays_khr(
652 physical_device.0,
653 plane_index,
654 count.as_mut_ptr(),
655 null_mut(),
656 )
657 })?;
658
659 Ok(unsafe { count.assume_init() })
660}
661
662#[cfg(feature = "VK_KHR_display")]
663#[inline]
664pub fn get_display_plane_supported_displays(
665 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
666 plane_index: u32,
667 sink: &mut [MaybeUninit<brvk::VkDisplayKHR>],
668) -> crate::Result<ArrayQueryResult<u32>> {
669 let mut v = sink.len() as _;
670 let r = ArrayQueryResult::from_vk_result(unsafe {
671 brvk::fns::get_display_plane_supported_displays_khr(
672 physical_device.0,
673 plane_index,
674 &mut v,
675 sink.as_mut_ptr().cast(),
676 )
677 })?;
678
679 Ok(r.with_result(v))
680}
681
682#[cfg(feature = "VK_KHR_surface")]
686#[inline]
687pub unsafe fn destroy_surface(
688 instance: VkHandleRef<brvk::VkInstance>,
689 surface: VkHandleRefMut<brvk::VkSurfaceKHR>,
690 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
691) {
692 unsafe { brvk::fns::destroy_surface_khr(instance.0, surface.0, opt_pointer(allocation_callbacks)) }
693}
694
695#[cfg(feature = "VK_KHR_swapchain")]
696#[inline]
697pub fn create_swapchain(
698 device: VkHandleRef<brvk::VkDevice>,
699 create_info: &SwapchainCreateInfo,
700 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
701) -> crate::Result<brvk::VkSwapchainKHR> {
702 let mut h = MaybeUninit::uninit();
703 translate_vk_result(unsafe {
704 brvk::fns::create_swapchain_khr(
705 device.0,
706 core::ptr::from_ref(create_info).cast(),
707 opt_pointer(allocation_callbacks),
708 h.as_mut_ptr(),
709 )
710 })?;
711
712 Ok(unsafe { h.assume_init() })
713}
714
715#[cfg(feature = "VK_KHR_swapchain")]
719#[inline]
720pub unsafe fn destroy_swapchain(
721 device: VkHandleRef<brvk::VkDevice>,
722 swapchain: VkHandleRefMut<brvk::VkSwapchainKHR>,
723 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
724) {
725 unsafe { brvk::fns::destroy_swapchain_khr(device.0, swapchain.0, opt_pointer(allocation_callbacks)) }
726}
727
728#[cfg(feature = "VK_KHR_swapchain")]
732#[inline]
733pub unsafe fn get_swapchain_image_count(
734 device: VkHandleRef<brvk::VkDevice>,
735 swapchain: VkHandleRef<brvk::VkSwapchainKHR>,
736) -> crate::Result<u32> {
737 let mut v = MaybeUninit::uninit();
738 translate_vk_result(unsafe {
739 brvk::fns::get_swapchain_images_khr(device.0, swapchain.0, v.as_mut_ptr(), null_mut())
740 })?;
741
742 Ok(unsafe { v.assume_init() })
743}
744
745#[cfg(feature = "VK_KHR_swapchain")]
749#[inline]
750pub unsafe fn get_swapchain_images(
751 device: VkHandleRef<brvk::VkDevice>,
752 swapchain: VkHandleRef<brvk::VkSwapchainKHR>,
753 sink: &mut [MaybeUninit<brvk::VkImage>],
754) -> crate::Result<ArrayQueryResult<u32>> {
755 let mut v = sink.len() as _;
756 let r = ArrayQueryResult::from_vk_result(unsafe {
757 brvk::fns::get_swapchain_images_khr(device.0, swapchain.0, &mut v, sink.as_mut_ptr().cast())
758 })?;
759
760 Ok(r.with_result(v))
761}
762
763#[cfg(feature = "VK_KHR_swapchain")]
767#[inline]
768pub unsafe fn acquire_next_image(
769 device: VkHandleRef<brvk::VkDevice>,
770 swapchain: VkHandleRefMut<brvk::VkSwapchainKHR>,
771 timeout: u64,
772 semaphore: Option<VkHandleRefMut<brvk::VkSemaphore>>,
773 fence: Option<VkHandleRefMut<brvk::VkFence>>,
774) -> crate::Result<u32> {
775 let mut v = MaybeUninit::uninit();
776 translate_vk_result(unsafe {
777 brvk::fns::acquire_next_image_khr(
778 device.0,
779 swapchain.0,
780 timeout,
781 semaphore.map(|x| x.0),
782 fence.map(|x| x.0),
783 v.as_mut_ptr(),
784 )
785 })?;
786
787 Ok(unsafe { v.assume_init() })
788}
789
790#[inline]
791pub fn create_device(
792 physical_device: VkHandleRef<brvk::VkPhysicalDevice>,
793 info: &DeviceCreateInfo,
794 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
795) -> crate::Result<brvk::VkDevice> {
796 let mut h = MaybeUninit::uninit();
797 translate_vk_result(unsafe {
798 brvk::fns::create_device(
799 physical_device.0,
800 core::ptr::from_ref(info).cast(),
801 opt_pointer(allocation_callbacks),
802 h.as_mut_ptr(),
803 )
804 })?;
805
806 Ok(unsafe { h.assume_init() })
807}
808
809#[inline]
813pub unsafe fn destroy_device(
814 device: VkHandleRefMut<brvk::VkDevice>,
815 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
816) {
817 unsafe { brvk::fns::destroy_device(device.0, opt_pointer(allocation_callbacks)) }
818}
819
820#[inline]
821pub fn get_device_queue(device: VkHandleRef<brvk::VkDevice>, family_index: u32, index: u32) -> brvk::VkQueue {
822 let mut h = MaybeUninit::uninit();
823 unsafe {
824 brvk::fns::get_device_queue(device.0, family_index, index, h.as_mut_ptr());
825 h.assume_init()
826 }
827}
828
829#[inline]
830pub fn queue_wait_idle(queue: VkHandleRefMut<brvk::VkQueue>) -> crate::Result<()> {
831 translate_vk_result(unsafe { brvk::fns::queue_wait_idle(queue.0) })?;
832
833 Ok(())
834}
835
836#[inline]
840pub unsafe fn device_wait_idle(device: VkHandleRef<brvk::VkDevice>) -> crate::Result<()> {
841 translate_vk_result(unsafe { brvk::fns::device_wait_idle(device.0) })?;
842
843 Ok(())
844}
845
846#[inline]
847pub fn get_instance_proc_addr_pfn<F: brvk::PFN>(instance: VkHandleRef<brvk::VkInstance>) -> Option<F> {
848 Some(unsafe { F::from_void_fn(brvk::fns::get_instance_proc_addr(instance.0, F::NAME_CSTR.as_ptr())?) })
849}
850
851#[inline]
852pub fn get_device_proc_addr_pfn<F: brvk::PFN>(device: VkHandleRef<brvk::VkDevice>) -> Option<F> {
853 Some(unsafe { F::from_void_fn(brvk::fns::get_device_proc_addr(device.0, F::NAME_CSTR.as_ptr())?) })
854}
855
856#[inline]
857pub fn queue_submit(
858 queue: VkHandleRefMut<brvk::VkQueue>,
859 submit_info: &[SubmitInfo],
860 fence: Option<VkHandleRefMut<brvk::VkFence>>,
861) -> crate::Result<()> {
862 translate_vk_result(unsafe {
863 brvk::fns::queue_submit(
864 queue.0,
865 submit_info.len() as _,
866 submit_info.as_ptr().cast(),
867 fence.map(|x| x.0),
868 )
869 })?;
870
871 Ok(())
872}
873
874#[cfg(feature = "Allow1_3APIs")]
875#[inline]
876pub fn queue_submit2(
877 queue: VkHandleRefMut<brvk::VkQueue>,
878 submit_info: &[SubmitInfo2],
879 fence: Option<VkHandleRefMut<brvk::VkFence>>,
880) -> crate::Result<()> {
881 translate_vk_result(unsafe {
882 brvk::fns::queue_submit2(
883 queue.0,
884 submit_info.len() as _,
885 submit_info.as_ptr().cast(),
886 fence.map(|x| x.0),
887 )
888 })?;
889
890 Ok(())
891}
892
893#[cfg(feature = "VK_KHR_swapchain")]
894#[inline]
895pub fn queue_present(queue: VkHandleRefMut<brvk::VkQueue>, present_info: &PresentInfo) -> crate::Result<PresentResult> {
896 match unsafe { brvk::fns::queue_present_khr(queue.0, core::ptr::from_ref(present_info).cast()) } {
897 brvk::VK_SUCCESS => Ok(PresentResult::Success),
898 brvk::VK_SUBOPTIMAL_KHR => Ok(PresentResult::Suboptimal),
899 e => match ResultCode(e) {
900 e if e.is_err() => Err(e),
901 e => unreachable!("unexpected result: {e:?}"),
902 },
903 }
904}
905
906#[inline]
907pub fn queue_bind_sparse(
908 queue: VkHandleRefMut<brvk::VkQueue>,
909 infos: &[BindSparseInfo],
910 fence: Option<VkHandleRefMut<brvk::VkFence>>,
911) -> crate::Result<()> {
912 translate_vk_result(unsafe {
913 brvk::fns::queue_bind_sparse(queue.0, infos.len() as _, infos.as_ptr().cast(), fence.map(|x| x.0))
914 })?;
915
916 Ok(())
917}
918
919#[inline]
920pub fn create_command_pool(
921 device: VkHandleRef<brvk::VkDevice>,
922 create_info: &CommandPoolCreateInfo,
923 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
924) -> crate::Result<brvk::VkCommandPool> {
925 let mut h = MaybeUninit::uninit();
926 translate_vk_result(unsafe {
927 brvk::fns::create_command_pool(
928 device.0,
929 core::ptr::from_ref(create_info).cast(),
930 opt_pointer(allocation_callbacks),
931 h.as_mut_ptr(),
932 )
933 })?;
934
935 Ok(unsafe { h.assume_init() })
936}
937
938#[inline]
942pub unsafe fn destroy_command_pool(
943 device: VkHandleRef<brvk::VkDevice>,
944 command_pool: VkHandleRefMut<brvk::VkCommandPool>,
945 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
946) {
947 unsafe { brvk::fns::destroy_command_pool(device.0, command_pool.0, opt_pointer(allocation_callbacks)) }
948}
949
950#[inline]
954pub unsafe fn allocate_command_buffers(
955 device: VkHandleRef<brvk::VkDevice>,
956 allocation_info: &CommandBufferAllocateInfo,
957 sink: &mut [MaybeUninit<brvk::VkCommandBuffer>],
958) -> crate::Result<()> {
959 translate_vk_result(unsafe {
960 brvk::fns::allocate_command_buffers(
961 device.0,
962 core::ptr::from_ref(allocation_info).cast(),
963 sink.as_mut_ptr().cast(),
964 )
965 })?;
966
967 Ok(())
968}
969
970#[inline]
975pub unsafe fn free_command_buffers(
976 device: VkHandleRef<brvk::VkDevice>,
977 command_pool: VkHandleRefMut<brvk::VkCommandPool>,
978 buffers: &[VkHandleRefMut<brvk::VkCommandBuffer>],
979) {
980 unsafe { brvk::fns::free_command_buffers(device.0, command_pool.0, buffers.len() as _, buffers.as_ptr().cast()) }
981}
982
983#[inline(always)]
987pub unsafe fn reset_command_pool(
988 device: VkHandleRef<brvk::VkDevice>,
989 command_pool: VkHandleRefMut<brvk::VkCommandPool>,
990 flags: CommandPoolResetFlags,
991) -> crate::Result<()> {
992 translate_vk_result(unsafe { brvk::fns::reset_command_pool(device.0, command_pool.0, flags.bits()) })?;
993
994 Ok(())
995}
996
997#[cfg(feature = "Allow1_1APIs")]
1001#[inline(always)]
1002pub unsafe fn trim_command_pool(
1003 device: VkHandleRef<brvk::VkDevice>,
1004 command_pool: VkHandleRefMut<brvk::VkCommandPool>,
1005 flags: CommandPoolTrimFlags,
1006) {
1007 unsafe {
1008 brvk::fns::trim_command_pool(device.0, command_pool.0, flags.bits());
1009 }
1010}
1011
1012#[inline]
1016pub unsafe fn begin_command_buffer(
1017 command_buffer: VkHandleRefMut<brvk::VkCommandBuffer>,
1018 begin_info: &CommandBufferBeginInfo,
1019) -> crate::Result<()> {
1020 translate_vk_result(unsafe {
1021 brvk::fns::begin_command_buffer(command_buffer.0, core::ptr::from_ref(begin_info).cast())
1022 })?;
1023
1024 Ok(())
1025}
1026
1027#[inline]
1031pub unsafe fn end_command_buffer(command_buffer: VkHandleRefMut<brvk::VkCommandBuffer>) -> crate::Result<()> {
1032 translate_vk_result(unsafe { brvk::fns::end_command_buffer(command_buffer.0) })?;
1033
1034 Ok(())
1035}
1036
1037#[inline]
1038pub fn create_fence(
1039 device: VkHandleRef<brvk::VkDevice>,
1040 info: &FenceCreateInfo,
1041 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1042) -> crate::Result<brvk::VkFence> {
1043 let mut h = MaybeUninit::uninit();
1044 translate_vk_result(unsafe {
1045 brvk::fns::create_fence(
1046 device.0,
1047 core::ptr::from_ref(info).cast(),
1048 opt_pointer(allocation_callbacks),
1049 h.as_mut_ptr(),
1050 )
1051 })?;
1052
1053 Ok(unsafe { h.assume_init() })
1054}
1055
1056#[inline]
1060pub unsafe fn destroy_fence(
1061 device: VkHandleRef<brvk::VkDevice>,
1062 fence: VkHandleRefMut<brvk::VkFence>,
1063 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1064) {
1065 unsafe { brvk::fns::destroy_fence(device.0, fence.0, opt_pointer(allocation_callbacks)) }
1066}
1067
1068#[inline]
1072pub unsafe fn wait_for_fences(
1073 device: VkHandleRef<brvk::VkDevice>,
1074 fences: &[VkHandleRef<brvk::VkFence>],
1075 wait_all: bool,
1076 timeout: u64,
1077) -> crate::Result<TimeoutableWaitResult> {
1078 Ok(TimeoutableWaitResult::from_vk_result(translate_vk_result(unsafe {
1079 brvk::fns::wait_for_fences(
1080 device.0,
1081 fences.len() as _,
1082 fences.as_ptr().cast(),
1083 wait_all as _,
1084 timeout,
1085 )
1086 })?))
1087}
1088
1089#[inline]
1093pub unsafe fn reset_fences(
1094 device: VkHandleRef<brvk::VkDevice>,
1095 fences: &[VkHandleRefMut<brvk::VkFence>],
1096) -> crate::Result<()> {
1097 translate_vk_result(unsafe { brvk::fns::reset_fences(device.0, fences.len() as _, fences.as_ptr().cast()) })?;
1098
1099 Ok(())
1100}
1101
1102#[inline]
1106pub unsafe fn get_fence_status(
1107 device: VkHandleRef<brvk::VkDevice>,
1108 fence: VkHandleRef<brvk::VkFence>,
1109) -> crate::Result<brvk::VkResult> {
1110 translate_vk_result(unsafe { brvk::fns::get_fence_status(device.0, fence.0) })
1111}
1112
1113#[inline]
1114pub fn create_semaphore(
1115 device: VkHandleRef<brvk::VkDevice>,
1116 create_info: &SemaphoreCreateInfo,
1117 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1118) -> crate::Result<brvk::VkSemaphore> {
1119 let mut h = MaybeUninit::uninit();
1120 translate_vk_result(unsafe {
1121 brvk::fns::create_semaphore(
1122 device.0,
1123 core::ptr::from_ref(create_info).cast(),
1124 opt_pointer(allocation_callbacks),
1125 h.as_mut_ptr(),
1126 )
1127 })?;
1128
1129 Ok(unsafe { h.assume_init() })
1130}
1131
1132#[inline]
1137pub unsafe fn destroy_semaphore(
1138 device: VkHandleRef<brvk::VkDevice>,
1139 semaphore: VkHandleRefMut<brvk::VkSemaphore>,
1140 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1141) {
1142 unsafe { brvk::fns::destroy_semaphore(device.0, semaphore.0, opt_pointer(allocation_callbacks)) }
1143}
1144
1145#[inline]
1146pub fn create_event(
1147 device: VkHandleRef<brvk::VkDevice>,
1148 create_info: &EventCreateInfo,
1149 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1150) -> crate::Result<brvk::VkEvent> {
1151 let mut h = MaybeUninit::uninit();
1152 crate::error::translate_vk_result(unsafe {
1153 brvk::fns::create_event(
1154 device.0,
1155 core::ptr::from_ref(create_info).cast(),
1156 opt_pointer(allocation_callbacks),
1157 h.as_mut_ptr(),
1158 )
1159 })?;
1160
1161 Ok(unsafe { h.assume_init() })
1162}
1163
1164#[inline]
1169pub unsafe fn destroy_event(
1170 device: VkHandleRef<brvk::VkDevice>,
1171 event: VkHandleRefMut<brvk::VkEvent>,
1172 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1173) {
1174 unsafe { brvk::fns::destroy_event(device.0, event.0, opt_pointer(allocation_callbacks)) }
1175}
1176
1177#[inline]
1178pub fn create_buffer(
1179 device: VkHandleRef<brvk::VkDevice>,
1180 create_info: &BufferCreateInfo,
1181 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1182) -> crate::Result<brvk::VkBuffer> {
1183 let mut h = MaybeUninit::uninit();
1184 translate_vk_result(unsafe {
1185 brvk::fns::create_buffer(
1186 device.0,
1187 core::ptr::from_ref(create_info).cast(),
1188 opt_pointer(allocation_callbacks),
1189 h.as_mut_ptr(),
1190 )
1191 })?;
1192
1193 Ok(unsafe { h.assume_init() })
1194}
1195
1196#[inline]
1200pub unsafe fn destroy_buffer(
1201 device: VkHandleRef<brvk::VkDevice>,
1202 buffer: VkHandleRefMut<brvk::VkBuffer>,
1203 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1204) {
1205 unsafe { brvk::fns::destroy_buffer(device.0, buffer.0, opt_pointer(allocation_callbacks)) }
1206}
1207
1208#[inline]
1212pub unsafe fn get_buffer_memory_requirements(
1213 device: VkHandleRef<brvk::VkDevice>,
1214 buffer: VkHandleRef<brvk::VkBuffer>,
1215) -> brvk::VkMemoryRequirements {
1216 let mut sink = MaybeUninit::uninit();
1217 unsafe {
1218 brvk::fns::get_buffer_memory_requirements(device.0, buffer.0, sink.as_mut_ptr());
1219
1220 sink.assume_init()
1221 }
1222}
1223
1224#[cfg(feature = "Allow1_1APIs")]
1228#[inline]
1229pub unsafe fn get_buffer_memory_requirements2(
1230 device: VkHandleRef<brvk::VkDevice>,
1231 info: &BufferMemoryRequirementsInfo2<'_, impl VkHandle<Handle = brvk::VkBuffer>>,
1232 sink: &mut MaybeUninit<brvk::VkMemoryRequirements2>,
1233) {
1234 unsafe { brvk::fns::get_buffer_memory_requirements2(device.0, info.as_ref(), sink.as_mut_ptr()) }
1235}
1236
1237#[inline]
1241pub unsafe fn bind_buffer_memory(
1242 device: VkHandleRef<brvk::VkDevice>,
1243 buffer: VkHandleRefMut<brvk::VkBuffer>,
1244 memory: VkHandleRef<brvk::VkDeviceMemory>,
1245 offset: brvk::VkDeviceSize,
1246) -> crate::Result<()> {
1247 translate_vk_result(unsafe { brvk::fns::bind_buffer_memory(device.0, buffer.0, memory.0, offset) })?;
1248
1249 Ok(())
1250}
1251
1252#[cfg(feature = "Allow1_1APIs")]
1256#[inline]
1257pub unsafe fn bind_buffer_memory2(
1258 device: VkHandleRef<brvk::VkDevice>,
1259 bind_infos: &[BindBufferMemoryInfo],
1260) -> crate::Result<()> {
1261 translate_vk_result(unsafe {
1262 brvk::fns::bind_buffer_memory2(device.0, bind_infos.len() as _, bind_infos.as_ptr().cast())
1263 })?;
1264
1265 Ok(())
1266}
1267
1268#[inline]
1269pub fn create_image(
1270 device: VkHandleRef<brvk::VkDevice>,
1271 create_info: &ImageCreateInfo,
1272 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1273) -> crate::Result<brvk::VkImage> {
1274 let mut h = MaybeUninit::uninit();
1275 translate_vk_result(unsafe {
1276 brvk::fns::create_image(
1277 device.0,
1278 create_info as *const _ as _,
1279 opt_pointer(allocation_callbacks),
1280 h.as_mut_ptr(),
1281 )
1282 })?;
1283
1284 Ok(unsafe { h.assume_init() })
1285}
1286
1287#[inline]
1291pub unsafe fn destroy_image(
1292 device: VkHandleRef<brvk::VkDevice>,
1293 image: VkHandleRefMut<brvk::VkImage>,
1294 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1295) {
1296 unsafe { brvk::fns::destroy_image(device.0, image.0, opt_pointer(allocation_callbacks)) }
1297}
1298
1299#[inline]
1303pub unsafe fn get_image_memory_requirements(
1304 device: VkHandleRef<brvk::VkDevice>,
1305 image: VkHandleRef<brvk::VkImage>,
1306) -> brvk::VkMemoryRequirements {
1307 let mut sink = MaybeUninit::uninit();
1308 unsafe {
1309 brvk::fns::get_image_memory_requirements(device.0, image.0, sink.as_mut_ptr());
1310
1311 sink.assume_init()
1312 }
1313}
1314
1315#[cfg(feature = "Allow1_1APIs")]
1319#[inline]
1320pub unsafe fn get_image_memory_requirements2(
1321 device: VkHandleRef<brvk::VkDevice>,
1322 info: &ImageMemoryRequirementsInfo2<'_, impl VkHandle<Handle = brvk::VkImage>>,
1323 sink: &mut MaybeUninit<brvk::VkMemoryRequirements2>,
1324) {
1325 unsafe { brvk::fns::get_image_memory_requirements2(device.0, info.as_ref(), sink.as_mut_ptr()) }
1326}
1327
1328#[inline]
1332pub unsafe fn bind_image_memory(
1333 device: VkHandleRef<brvk::VkDevice>,
1334 image: VkHandleRefMut<brvk::VkImage>,
1335 memory: VkHandleRef<brvk::VkDeviceMemory>,
1336 offset: brvk::VkDeviceSize,
1337) -> crate::Result<()> {
1338 translate_vk_result(unsafe { brvk::fns::bind_image_memory(device.0, image.0, memory.0, offset) })?;
1339
1340 Ok(())
1341}
1342
1343#[cfg(feature = "Allow1_1APIs")]
1347#[inline]
1348pub unsafe fn bind_image_memory2(
1349 device: VkHandleRef<brvk::VkDevice>,
1350 bind_infos: &[BindImageMemoryInfo],
1351) -> crate::Result<()> {
1352 translate_vk_result(unsafe {
1353 brvk::fns::bind_image_memory2(device.0, bind_infos.len() as _, bind_infos.as_ptr().cast())
1354 })?;
1355
1356 Ok(())
1357}
1358
1359#[inline]
1360pub fn create_sampler(
1361 device: VkHandleRef<brvk::VkDevice>,
1362 create_info: &SamplerCreateInfo,
1363 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1364) -> crate::Result<brvk::VkSampler> {
1365 let mut h = MaybeUninit::uninit();
1366 translate_vk_result(unsafe {
1367 brvk::fns::create_sampler(
1368 device.0,
1369 core::ptr::from_ref(create_info).cast(),
1370 opt_pointer(allocation_callbacks),
1371 h.as_mut_ptr(),
1372 )
1373 })?;
1374
1375 Ok(unsafe { h.assume_init() })
1376}
1377
1378#[inline]
1382pub unsafe fn destroy_sampler(
1383 device: VkHandleRef<brvk::VkDevice>,
1384 sampler: VkHandleRefMut<brvk::VkSampler>,
1385 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1386) {
1387 unsafe { brvk::fns::destroy_sampler(device.0, sampler.0, opt_pointer(allocation_callbacks)) }
1388}
1389
1390#[inline]
1391pub fn allocate_memory(
1392 device: VkHandleRef<brvk::VkDevice>,
1393 allocate_info: &MemoryAllocateInfo,
1394 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1395) -> crate::Result<brvk::VkDeviceMemory> {
1396 let mut h = MaybeUninit::uninit();
1397 translate_vk_result(unsafe {
1398 brvk::fns::allocate_memory(
1399 device.0,
1400 core::ptr::from_ref(allocate_info).cast(),
1401 opt_pointer(allocation_callbacks),
1402 h.as_mut_ptr(),
1403 )
1404 })?;
1405
1406 Ok(unsafe { h.assume_init() })
1407}
1408
1409#[inline]
1413pub unsafe fn free_memory(
1414 device: VkHandleRef<brvk::VkDevice>,
1415 memory: VkHandleRefMut<brvk::VkDeviceMemory>,
1416 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1417) {
1418 unsafe { brvk::fns::free_memory(device.0, memory.0, opt_pointer(allocation_callbacks)) }
1419}
1420
1421#[inline]
1425pub unsafe fn map_memory(
1426 device: VkHandleRef<brvk::VkDevice>,
1427 memory: VkHandleRefMut<brvk::VkDeviceMemory>,
1428 range: core::ops::Range<brvk::VkDeviceSize>,
1429 flags: brvk::VkMemoryMapFlags,
1430) -> crate::Result<*mut core::ffi::c_void> {
1431 let mut p = MaybeUninit::uninit();
1432 translate_vk_result(unsafe {
1433 brvk::fns::map_memory(
1434 device.0,
1435 memory.0,
1436 range.start,
1437 range.end - range.start,
1438 flags,
1439 p.as_mut_ptr(),
1440 )
1441 })?;
1442
1443 Ok(unsafe { p.assume_init() })
1444}
1445
1446#[inline]
1450pub unsafe fn unmap_memory(device: VkHandleRef<brvk::VkDevice>, memory: VkHandleRefMut<brvk::VkDeviceMemory>) {
1451 unsafe { brvk::fns::unmap_memory(device.0, memory.0) }
1452}
1453
1454#[inline]
1455pub fn invalidate_mapped_memory_ranges(
1456 device: VkHandleRef<brvk::VkDevice>,
1457 memory_ranges: &[MappedMemoryRange],
1458) -> crate::Result<()> {
1459 translate_vk_result(unsafe {
1460 brvk::fns::invalidate_mapped_memory_ranges(device.0, memory_ranges.len() as _, memory_ranges.as_ptr().cast())
1461 })?;
1462
1463 Ok(())
1464}
1465
1466#[inline]
1467pub fn flush_mapped_memory_ranges(
1468 device: VkHandleRef<brvk::VkDevice>,
1469 memory_ranges: &[MappedMemoryRange],
1470) -> crate::Result<()> {
1471 translate_vk_result(unsafe {
1472 brvk::fns::flush_mapped_memory_ranges(device.0, memory_ranges.len() as _, memory_ranges.as_ptr().cast())
1473 })?;
1474
1475 Ok(())
1476}
1477
1478#[inline]
1482pub unsafe fn create_image_view(
1483 device: VkHandleRef<brvk::VkDevice>,
1484 create_info: &ImageViewCreateInfo,
1485 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1486) -> crate::Result<brvk::VkImageView> {
1487 let mut h = MaybeUninit::uninit();
1488 translate_vk_result(unsafe {
1489 brvk::fns::create_image_view(
1490 device.0,
1491 core::ptr::from_ref(create_info).cast(),
1492 opt_pointer(allocation_callbacks),
1493 h.as_mut_ptr(),
1494 )
1495 })?;
1496
1497 Ok(unsafe { h.assume_init() })
1498}
1499
1500#[inline]
1504pub unsafe fn destroy_image_view(
1505 device: VkHandleRef<brvk::VkDevice>,
1506 image_view: VkHandleRefMut<brvk::VkImageView>,
1507 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1508) {
1509 unsafe { brvk::fns::destroy_image_view(device.0, image_view.0, opt_pointer(allocation_callbacks)) }
1510}
1511
1512#[inline]
1516pub unsafe fn create_buffer_view(
1517 device: VkHandleRef<brvk::VkDevice>,
1518 create_info: &BufferViewCreateInfo,
1519 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1520) -> crate::Result<brvk::VkBufferView> {
1521 let mut h = MaybeUninit::uninit();
1522 translate_vk_result(unsafe {
1523 brvk::fns::create_buffer_view(
1524 device.0,
1525 core::ptr::from_ref(create_info).cast(),
1526 opt_pointer(allocation_callbacks),
1527 h.as_mut_ptr(),
1528 )
1529 })?;
1530
1531 Ok(unsafe { h.assume_init() })
1532}
1533
1534#[inline]
1538pub unsafe fn destroy_buffer_view(
1539 device: VkHandleRef<brvk::VkDevice>,
1540 buffer_view: VkHandleRefMut<brvk::VkBufferView>,
1541 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1542) {
1543 unsafe { brvk::fns::destroy_buffer_view(device.0, buffer_view.0, opt_pointer(allocation_callbacks)) }
1544}
1545
1546#[inline]
1550pub unsafe fn create_framebuffer(
1551 device: VkHandleRef<brvk::VkDevice>,
1552 create_info: &FramebufferCreateInfo,
1553 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1554) -> crate::Result<brvk::VkFramebuffer> {
1555 let mut h = MaybeUninit::uninit();
1556 translate_vk_result(unsafe {
1557 brvk::fns::create_framebuffer(
1558 device.0,
1559 core::ptr::from_ref(create_info).cast(),
1560 opt_pointer(allocation_callbacks),
1561 h.as_mut_ptr(),
1562 )
1563 })?;
1564
1565 Ok(unsafe { h.assume_init() })
1566}
1567
1568#[inline]
1572pub unsafe fn destroy_framebuffer(
1573 device: VkHandleRef<brvk::VkDevice>,
1574 framebuffer: VkHandleRefMut<brvk::VkFramebuffer>,
1575 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1576) {
1577 unsafe { brvk::fns::destroy_framebuffer(device.0, framebuffer.0, opt_pointer(allocation_callbacks)) }
1578}
1579
1580#[inline]
1581pub fn create_shader_module(
1582 device: VkHandleRef<brvk::VkDevice>,
1583 info: &ShaderModuleCreateInfo,
1584 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1585) -> crate::Result<brvk::VkShaderModule> {
1586 let mut h = MaybeUninit::uninit();
1587 translate_vk_result(unsafe {
1588 brvk::fns::create_shader_module(
1589 device.0,
1590 core::ptr::from_ref(info).cast(),
1591 opt_pointer(allocation_callbacks),
1592 h.as_mut_ptr(),
1593 )
1594 })?;
1595
1596 Ok(unsafe { h.assume_init() })
1597}
1598
1599#[inline]
1603pub unsafe fn destroy_shader_module(
1604 device: VkHandleRef<brvk::VkDevice>,
1605 shader_module: VkHandleRefMut<brvk::VkShaderModule>,
1606 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1607) {
1608 unsafe { brvk::fns::destroy_shader_module(device.0, shader_module.0, opt_pointer(allocation_callbacks)) }
1609}
1610
1611#[inline]
1615pub unsafe fn create_graphics_pipelines(
1616 device: VkHandleRef<brvk::VkDevice>,
1617 pipeline_cache: Option<VkHandleRef<brvk::VkPipelineCache>>,
1618 create_infos: &[GraphicsPipelineCreateInfo],
1619 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1620 results: &mut [MaybeUninit<brvk::VkPipeline>],
1621) -> crate::Result<()> {
1622 debug_assert!(results.len() >= create_infos.len());
1623
1624 translate_vk_result(unsafe {
1625 brvk::fns::create_graphics_pipelines(
1626 device.0,
1627 pipeline_cache.map(|x| x.0),
1628 create_infos.len() as _,
1629 create_infos.as_ptr().cast(),
1630 opt_pointer(allocation_callbacks),
1631 results.as_mut_ptr().cast(),
1632 )
1633 })?;
1634
1635 Ok(())
1636}
1637
1638#[inline]
1642pub unsafe fn create_graphics_pipeline_array<const N: usize>(
1643 device: VkHandleRef<brvk::VkDevice>,
1644 pipeline_cache: Option<VkHandleRef<brvk::VkPipelineCache>>,
1645 create_infos: &[GraphicsPipelineCreateInfo; N],
1646 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1647) -> crate::Result<[brvk::VkPipeline; N]> {
1648 let mut results = [MaybeUninit::uninit(); N];
1649 unsafe {
1650 create_graphics_pipelines(device, pipeline_cache, create_infos, allocation_callbacks, &mut results)?;
1651 }
1652
1653 Ok(core::array::from_fn(|n| unsafe { results[n].assume_init() }))
1654}
1655
1656#[inline]
1660pub unsafe fn create_compute_pipelines(
1661 device: VkHandleRef<brvk::VkDevice>,
1662 pipeline_cache: Option<VkHandleRef<brvk::VkPipelineCache>>,
1663 create_infos: &[ComputePipelineCreateInfo],
1664 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1665 results: &mut [MaybeUninit<brvk::VkPipeline>],
1666) -> crate::Result<()> {
1667 debug_assert!(results.len() >= create_infos.len());
1668
1669 translate_vk_result(unsafe {
1670 brvk::fns::create_compute_pipelines(
1671 device.0,
1672 pipeline_cache.map(|x| x.0),
1673 create_infos.len() as _,
1674 create_infos.as_ptr().cast(),
1675 opt_pointer(allocation_callbacks),
1676 results.as_mut_ptr().cast(),
1677 )
1678 })?;
1679
1680 Ok(())
1681}
1682
1683#[inline]
1687pub unsafe fn create_compute_pipeline_array<const N: usize>(
1688 device: VkHandleRef<brvk::VkDevice>,
1689 pipeline_cache: Option<VkHandleRef<brvk::VkPipelineCache>>,
1690 create_infos: &[ComputePipelineCreateInfo; N],
1691 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1692) -> crate::Result<[brvk::VkPipeline; N]> {
1693 let mut results = [MaybeUninit::uninit(); N];
1694 unsafe {
1695 create_compute_pipelines(device, pipeline_cache, create_infos, allocation_callbacks, &mut results)?;
1696 }
1697
1698 Ok(core::array::from_fn(|n| unsafe { results[n].assume_init() }))
1699}
1700
1701#[inline]
1705pub unsafe fn destroy_pipeline(
1706 device: VkHandleRef<brvk::VkDevice>,
1707 pipeline: VkHandleRefMut<brvk::VkPipeline>,
1708 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1709) {
1710 unsafe { brvk::fns::destroy_pipeline(device.0, pipeline.0, opt_pointer(allocation_callbacks)) }
1711}
1712
1713#[inline]
1714pub fn create_pipeline_layout(
1715 device: VkHandleRef<brvk::VkDevice>,
1716 create_info: &PipelineLayoutCreateInfo,
1717 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1718) -> crate::Result<brvk::VkPipelineLayout> {
1719 let mut h = MaybeUninit::uninit();
1720 translate_vk_result(unsafe {
1721 brvk::fns::create_pipeline_layout(
1722 device.0,
1723 core::ptr::from_ref(create_info).cast(),
1724 opt_pointer(allocation_callbacks),
1725 h.as_mut_ptr(),
1726 )
1727 })?;
1728
1729 Ok(unsafe { h.assume_init() })
1730}
1731
1732#[inline]
1736pub unsafe fn destroy_pipeline_layout(
1737 device: VkHandleRef<brvk::VkDevice>,
1738 pipeline_layout: VkHandleRefMut<brvk::VkPipelineLayout>,
1739 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1740) {
1741 unsafe { brvk::fns::destroy_pipeline_layout(device.0, pipeline_layout.0, opt_pointer(allocation_callbacks)) }
1742}
1743
1744#[inline]
1745pub fn create_pipeline_cache(
1746 device: VkHandleRef<brvk::VkDevice>,
1747 info: &PipelineCacheCreateInfo,
1748 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1749) -> crate::Result<brvk::VkPipelineCache> {
1750 let mut h = MaybeUninit::uninit();
1751 translate_vk_result(unsafe {
1752 brvk::fns::create_pipeline_cache(
1753 device.0,
1754 core::ptr::from_ref(info).cast(),
1755 opt_pointer(allocation_callbacks),
1756 h.as_mut_ptr(),
1757 )
1758 })?;
1759
1760 Ok(unsafe { h.assume_init() })
1761}
1762
1763#[inline]
1767pub unsafe fn destroy_pipeline_cache(
1768 device: VkHandleRef<brvk::VkDevice>,
1769 pipeline_cache: VkHandleRefMut<brvk::VkPipelineCache>,
1770 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1771) {
1772 unsafe { brvk::fns::destroy_pipeline_cache(device.0, pipeline_cache.0, opt_pointer(allocation_callbacks)) }
1773}
1774
1775#[inline]
1779pub unsafe fn get_pipeline_cache_data_byte_length(
1780 device: VkHandleRef<brvk::VkDevice>,
1781 pipeline_cache: VkHandleRef<brvk::VkPipelineCache>,
1782) -> crate::Result<usize> {
1783 let mut len = MaybeUninit::uninit();
1784 translate_vk_result(unsafe {
1785 brvk::fns::get_pipeline_cache_data(device.0, pipeline_cache.0, len.as_mut_ptr(), null_mut())
1786 })?;
1787
1788 Ok(unsafe { len.assume_init() })
1789}
1790
1791#[inline]
1795pub unsafe fn get_pipeline_cache_data(
1796 device: VkHandleRef<brvk::VkDevice>,
1797 pipeline_cache: VkHandleRef<brvk::VkPipelineCache>,
1798 sink: &mut [MaybeUninit<u8>],
1799) -> crate::Result<ArrayQueryResult<usize>> {
1800 let mut len = sink.len();
1801 let r = ArrayQueryResult::from_vk_result(unsafe {
1802 brvk::fns::get_pipeline_cache_data(device.0, pipeline_cache.0, &mut len, sink.as_mut_ptr().cast())
1803 })?;
1804
1805 Ok(r.with_result(len))
1806}
1807
1808#[cfg(feature = "Allow1_2APIs")]
1813#[inline]
1814pub unsafe fn get_semaphore_counter_value(
1815 device: VkHandleRef<brvk::VkDevice>,
1816 semaphore: VkHandleRef<brvk::VkSemaphore>,
1817) -> crate::Result<u64> {
1818 let mut value = MaybeUninit::uninit();
1819 translate_vk_result(unsafe { brvk::fns::get_semaphore_counter_value(device.0, semaphore.0, value.as_mut_ptr()) })?;
1820
1821 Ok(unsafe { value.assume_init() })
1822}
1823
1824#[cfg(feature = "Allow1_2APIs")]
1829#[inline]
1830pub unsafe fn signal_semaphore(
1831 device: VkHandleRef<brvk::VkDevice>,
1832 signal_info: &SemaphoreSignalInfo,
1833) -> crate::Result<()> {
1834 translate_vk_result(unsafe { brvk::fns::signal_semaphore(device.0, core::ptr::from_ref(signal_info).cast()) })?;
1835
1836 Ok(())
1837}
1838
1839#[cfg(feature = "Allow1_2APIs")]
1844#[inline]
1845pub unsafe fn wait_semaphores(
1846 device: VkHandleRef<brvk::VkDevice>,
1847 wait_info: &SemaphoreWaitInfo,
1848 timeout: u64,
1849) -> crate::Result<TimeoutableWaitResult> {
1850 Ok(TimeoutableWaitResult::from_vk_result(translate_vk_result(unsafe {
1851 brvk::fns::wait_semaphores(device.0, core::ptr::from_ref(wait_info).cast(), timeout)
1852 })?))
1853}
1854
1855#[inline]
1856pub fn create_descriptor_pool(
1857 device: VkHandleRef<brvk::VkDevice>,
1858 info: &DescriptorPoolCreateInfo,
1859 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1860) -> crate::Result<brvk::VkDescriptorPool> {
1861 let mut h = MaybeUninit::uninit();
1862 translate_vk_result(unsafe {
1863 brvk::fns::create_descriptor_pool(
1864 device.0,
1865 core::ptr::from_ref(info).cast(),
1866 opt_pointer(allocation_callbacks),
1867 h.as_mut_ptr(),
1868 )
1869 })?;
1870
1871 Ok(unsafe { h.assume_init() })
1872}
1873
1874#[inline]
1878pub unsafe fn destroy_descriptor_pool(
1879 device: VkHandleRef<brvk::VkDevice>,
1880 descriptor_pool: VkHandleRefMut<brvk::VkDescriptorPool>,
1881 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1882) {
1883 unsafe { brvk::fns::destroy_descriptor_pool(device.0, descriptor_pool.0, opt_pointer(allocation_callbacks)) }
1884}
1885
1886#[inline]
1891pub unsafe fn reset_descriptor_pool(
1892 device: VkHandleRef<brvk::VkDevice>,
1893 descriptor_pool: VkHandleRefMut<brvk::VkDescriptorPool>,
1894 flags: brvk::VkDescriptorPoolResetFlags,
1895) -> crate::Result<()> {
1896 translate_vk_result(unsafe { brvk::fns::reset_descriptor_pool(device.0, descriptor_pool.0, flags) })?;
1897
1898 Ok(())
1899}
1900
1901#[inline]
1907pub unsafe fn allocate_descriptor_sets(
1908 device: VkHandleRef<brvk::VkDevice>,
1909 info: &brvk::VkDescriptorSetAllocateInfo,
1910 sink: &mut [MaybeUninit<DescriptorSet>],
1911) -> crate::Result<()> {
1912 translate_vk_result(unsafe { brvk::fns::allocate_descriptor_sets(device.0, info, sink.as_mut_ptr().cast()) })?;
1913
1914 Ok(())
1915}
1916
1917#[inline]
1923pub unsafe fn free_descriptor_sets(
1924 device: VkHandleRef<brvk::VkDevice>,
1925 descriptor_pool: VkHandleRefMut<brvk::VkDescriptorPool>,
1926 descriptor_sets: &[DescriptorSet],
1927) -> crate::Result<()> {
1928 translate_vk_result(unsafe {
1929 brvk::fns::free_descriptor_sets(
1930 device.0,
1931 descriptor_pool.0,
1932 descriptor_sets.len() as _,
1933 descriptor_sets.as_ptr().cast(),
1934 )
1935 })?;
1936
1937 Ok(())
1938}
1939
1940#[inline]
1944pub unsafe fn update_descriptor_sets(
1945 device: VkHandleRef<brvk::VkDevice>,
1946 writes: &[brvk::VkWriteDescriptorSet],
1947 copies: &[brvk::VkCopyDescriptorSet],
1948) {
1949 unsafe {
1950 brvk::fns::update_descriptor_sets(
1951 device.0,
1952 writes.len() as _,
1953 writes.as_ptr(),
1954 copies.len() as _,
1955 copies.as_ptr(),
1956 );
1957 }
1958}
1959
1960#[inline]
1961pub fn create_descriptor_set_layout(
1962 device: VkHandleRef<brvk::VkDevice>,
1963 info: &DescriptorSetLayoutCreateInfo,
1964 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1965) -> crate::Result<brvk::VkDescriptorSetLayout> {
1966 let mut h = MaybeUninit::uninit();
1967 translate_vk_result(unsafe {
1968 brvk::fns::create_descriptor_set_layout(
1969 device.0,
1970 core::ptr::from_ref(info).cast(),
1971 opt_pointer(allocation_callbacks),
1972 h.as_mut_ptr(),
1973 )
1974 })?;
1975
1976 Ok(unsafe { h.assume_init() })
1977}
1978
1979#[inline]
1983pub unsafe fn destroy_descriptor_set_layout(
1984 device: VkHandleRef<brvk::VkDevice>,
1985 descriptor_set_layout: VkHandleRefMut<brvk::VkDescriptorSetLayout>,
1986 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
1987) {
1988 unsafe {
1989 brvk::fns::destroy_descriptor_set_layout(device.0, descriptor_set_layout.0, opt_pointer(allocation_callbacks))
1990 }
1991}
1992
1993#[inline]
1997#[cfg(feature = "Allow1_1APIs")]
1998pub unsafe fn create_descriptor_update_template(
1999 device: VkHandleRef<brvk::VkDevice>,
2000 create_info: &brvk::VkDescriptorUpdateTemplateCreateInfo,
2001 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2002) -> crate::Result<brvk::VkDescriptorUpdateTemplate> {
2003 let mut h = core::mem::MaybeUninit::uninit();
2004 translate_vk_result(unsafe {
2005 brvk::fns::create_descriptor_update_template(
2006 device.0,
2007 core::ptr::from_ref(create_info).cast(),
2008 opt_pointer(allocation_callbacks),
2009 h.as_mut_ptr(),
2010 )
2011 })?;
2012
2013 Ok(unsafe { h.assume_init() })
2014}
2015
2016#[inline]
2020#[cfg(feature = "Allow1_1APIs")]
2021pub unsafe fn destroy_descriptor_update_template(
2022 device: VkHandleRef<brvk::VkDevice>,
2023 descriptor_update_template: VkHandleRefMut<brvk::VkDescriptorUpdateTemplate>,
2024 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2025) {
2026 unsafe {
2027 brvk::fns::destroy_descriptor_update_template(
2028 device.0,
2029 descriptor_update_template.0,
2030 opt_pointer(allocation_callbacks),
2031 )
2032 }
2033}
2034
2035#[inline]
2036pub fn create_render_pass(
2037 device: VkHandleRef<brvk::VkDevice>,
2038 info: &RenderPassCreateInfo,
2039 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2040) -> crate::Result<brvk::VkRenderPass> {
2041 let mut h = core::mem::MaybeUninit::uninit();
2042 translate_vk_result(unsafe {
2043 brvk::fns::create_render_pass(
2044 device.0,
2045 core::ptr::from_ref(info).cast(),
2046 opt_pointer(allocation_callbacks),
2047 h.as_mut_ptr(),
2048 )
2049 })?;
2050
2051 Ok(unsafe { h.assume_init() })
2052}
2053
2054#[inline]
2055#[cfg(feature = "Allow1_2APIs")]
2056pub fn create_render_pass2(
2057 device: VkHandleRef<brvk::VkDevice>,
2058 info: &RenderPassCreateInfo2,
2059 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2060) -> crate::Result<brvk::VkRenderPass> {
2061 let mut h = core::mem::MaybeUninit::uninit();
2062 translate_vk_result(unsafe {
2063 brvk::fns::create_render_pass2(
2064 device.0,
2065 core::ptr::from_ref(info).cast(),
2066 opt_pointer(allocation_callbacks),
2067 h.as_mut_ptr(),
2068 )
2069 })?;
2070
2071 Ok(unsafe { h.assume_init() })
2072}
2073
2074#[inline]
2078pub unsafe fn destroy_render_pass(
2079 device: VkHandleRef<brvk::VkDevice>,
2080 render_pass: VkHandleRefMut<brvk::VkRenderPass>,
2081 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2082) {
2083 unsafe {
2084 brvk::fns::destroy_render_pass(device.0, render_pass.0, opt_pointer(allocation_callbacks));
2085 }
2086}
2087
2088#[inline]
2089pub fn create_query_pool(
2090 device: VkHandleRef<brvk::VkDevice>,
2091 info: &QueryPoolCreateInfo,
2092 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2093) -> crate::Result<brvk::VkQueryPool> {
2094 let mut h = core::mem::MaybeUninit::uninit();
2095 translate_vk_result(unsafe {
2096 brvk::fns::create_query_pool(
2097 device.0,
2098 core::ptr::from_ref(info).cast(),
2099 opt_pointer(allocation_callbacks),
2100 h.as_mut_ptr(),
2101 )
2102 })?;
2103
2104 Ok(unsafe { h.assume_init() })
2105}
2106
2107#[inline]
2111pub unsafe fn destroy_query_pool(
2112 device: VkHandleRef<brvk::VkDevice>,
2113 query_pool: VkHandleRefMut<brvk::VkQueryPool>,
2114 allocation_callbacks: Option<&brvk::VkAllocationCallbacks>,
2115) {
2116 unsafe {
2117 brvk::fns::destroy_query_pool(device.0, query_pool.0, opt_pointer(allocation_callbacks));
2118 }
2119}