Add VK_KHR_maintenance extensions (#406)

This commit is contained in:
Rua 2021-03-20 13:52:10 +01:00 committed by GitHub
parent 8444db4fb2
commit a0a1f5d135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 0 deletions

View file

@ -0,0 +1,45 @@
#![allow(dead_code)]
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use std::ffi::CStr;
use std::mem;
#[derive(Clone)]
pub struct Maintenance1 {
handle: vk::Device,
fns: vk::KhrMaintenance1Fn,
}
impl Maintenance1 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Maintenance1 {
let fns = vk::KhrMaintenance1Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Maintenance1 {
handle: device.handle(),
fns,
}
}
pub fn name() -> &'static CStr {
vk::KhrMaintenance1Fn::name()
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkTrimCommandPoolKHR.html>"]
unsafe fn trim_command_pool(
&self,
command_pool: vk::CommandPool,
flags: vk::CommandPoolTrimFlagsKHR,
) {
self.fns
.trim_command_pool_khr(self.handle, command_pool, flags);
}
pub fn fp(&self) -> &vk::KhrMaintenance1Fn {
&self.fns
}
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -0,0 +1,45 @@
#![allow(dead_code)]
use crate::version::{DeviceV1_0, InstanceV1_0};
use crate::vk;
use std::ffi::CStr;
use std::mem;
#[derive(Clone)]
pub struct Maintenance3 {
handle: vk::Device,
fns: vk::KhrMaintenance3Fn,
}
impl Maintenance3 {
pub fn new<I: InstanceV1_0, D: DeviceV1_0>(instance: &I, device: &D) -> Maintenance3 {
let fns = vk::KhrMaintenance3Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr()))
});
Maintenance3 {
handle: device.handle(),
fns,
}
}
pub fn name() -> &'static CStr {
vk::KhrMaintenance3Fn::name()
}
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkGetDescriptorSetLayoutSupportKHR.html>"]
unsafe fn get_descriptor_set_layout_support(
&self,
create_info: &vk::DescriptorSetLayoutCreateInfo,
out: &mut vk::DescriptorSetLayoutSupportKHR,
) {
self.fns
.get_descriptor_set_layout_support_khr(self.handle, create_info, out);
}
pub fn fp(&self) -> &vk::KhrMaintenance3Fn {
&self.fns
}
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -5,6 +5,8 @@ pub use self::display::Display;
pub use self::display_swapchain::DisplaySwapchain;
pub use self::draw_indirect_count::DrawIndirectCount;
pub use self::external_memory_fd::ExternalMemoryFd;
pub use self::maintenance1::Maintenance1;
pub use self::maintenance3::Maintenance3;
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
pub use self::push_descriptor::PushDescriptor;
pub use self::ray_tracing_pipeline::RayTracingPipeline;
@ -23,6 +25,8 @@ mod display;
mod display_swapchain;
mod draw_indirect_count;
mod external_memory_fd;
mod maintenance1;
mod maintenance3;
mod pipeline_executable_properties;
mod push_descriptor;
mod ray_tracing_pipeline;