extensions: Add VK_KHR_maintenance4
This commit is contained in:
parent
e120dd7838
commit
50d58fd04e
88
ash/src/extensions/khr/maintenance4.rs
Normal file
88
ash/src/extensions/khr/maintenance4.rs
Normal file
|
@ -0,0 +1,88 @@
|
|||
use crate::vk;
|
||||
use crate::{Device, Instance};
|
||||
use std::ffi::CStr;
|
||||
use std::mem;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Maintenance4 {
|
||||
handle: vk::Device,
|
||||
fns: vk::KhrMaintenance4Fn,
|
||||
}
|
||||
|
||||
impl Maintenance4 {
|
||||
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||
let fns = vk::KhrMaintenance4Fn::load(|name| unsafe {
|
||||
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
|
||||
});
|
||||
Self {
|
||||
handle: device.handle(),
|
||||
fns,
|
||||
}
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetDeviceBufferMemoryRequirementsKHR.html>"]
|
||||
pub unsafe fn get_device_buffer_memory_requirements(
|
||||
&self,
|
||||
create_info: &vk::DeviceBufferMemoryRequirementsKHR,
|
||||
out: &mut vk::MemoryRequirements2,
|
||||
) {
|
||||
self.fns
|
||||
.get_device_buffer_memory_requirements_khr(self.handle, create_info, out)
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetDeviceImageMemoryRequirementsKHR.html>"]
|
||||
pub unsafe fn get_device_image_memory_requirements(
|
||||
&self,
|
||||
create_info: &vk::DeviceImageMemoryRequirementsKHR,
|
||||
out: &mut vk::MemoryRequirements2,
|
||||
) {
|
||||
self.fns
|
||||
.get_device_image_memory_requirements_khr(self.handle, create_info, out)
|
||||
}
|
||||
|
||||
/// Retrieve the number of elements to pass to [`Self::get_device_image_sparse_memory_requirements()`]
|
||||
pub unsafe fn get_device_image_sparse_memory_requirements_len(
|
||||
&self,
|
||||
create_info: &vk::DeviceImageMemoryRequirementsKHR,
|
||||
) -> usize {
|
||||
let mut count = 0;
|
||||
self.fns.get_device_image_sparse_memory_requirements_khr(
|
||||
self.handle,
|
||||
create_info,
|
||||
&mut count,
|
||||
std::ptr::null_mut(),
|
||||
);
|
||||
count as usize
|
||||
}
|
||||
|
||||
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetDeviceImageSparseMemoryRequirementsKHR.html>"]
|
||||
///
|
||||
/// Call [`Self::get_device_image_sparse_memory_requirements_len()`] to query the number of elements to pass to `sparse_memory_requirements`.
|
||||
/// Be sure to [`Default::default()`]-initialize these elements and optionally set their `p_next` pointer.
|
||||
pub unsafe fn get_device_image_sparse_memory_requirements(
|
||||
&self,
|
||||
create_info: &vk::DeviceImageMemoryRequirementsKHR,
|
||||
out: &mut [vk::SparseImageMemoryRequirements2],
|
||||
) {
|
||||
let mut count = out.len() as u32;
|
||||
self.fns.get_device_image_sparse_memory_requirements_khr(
|
||||
self.handle,
|
||||
create_info,
|
||||
&mut count,
|
||||
out.as_mut_ptr(),
|
||||
);
|
||||
assert_eq!(count, out.len() as u32);
|
||||
}
|
||||
|
||||
pub fn name() -> &'static CStr {
|
||||
vk::KhrMaintenance4Fn::name()
|
||||
}
|
||||
|
||||
pub fn fp(&self) -> &vk::KhrMaintenance4Fn {
|
||||
&self.fns
|
||||
}
|
||||
|
||||
pub fn device(&self) -> vk::Device {
|
||||
self.handle
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ pub use self::get_memory_requirements2::GetMemoryRequirements2;
|
|||
pub use self::get_physical_device_properties2::GetPhysicalDeviceProperties2;
|
||||
pub use self::maintenance1::Maintenance1;
|
||||
pub use self::maintenance3::Maintenance3;
|
||||
pub use self::maintenance4::Maintenance4;
|
||||
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
|
||||
pub use self::push_descriptor::PushDescriptor;
|
||||
pub use self::ray_tracing_pipeline::RayTracingPipeline;
|
||||
|
@ -42,6 +43,7 @@ mod get_memory_requirements2;
|
|||
mod get_physical_device_properties2;
|
||||
mod maintenance1;
|
||||
mod maintenance3;
|
||||
mod maintenance4;
|
||||
mod pipeline_executable_properties;
|
||||
mod push_descriptor;
|
||||
mod ray_tracing_pipeline;
|
||||
|
|
Loading…
Reference in a new issue