extensions/khr: Add VK_KHR_maintenance5 (#780)

This commit is contained in:
Marijn Suijten 2023-08-14 16:09:06 +02:00 committed by GitHub
parent 95ff15ff72
commit b91c2aac92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 2 deletions

View file

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_AMD_shader_info` device extension (#773)
- Added `VK_AMDX_shader_enqueue` device extension (#776)
- Added `VK_EXT_host_image_copy` device extension (#779)
- Added `VK_KHR_maintenance5` device extension (#780)
### Changed

View file

@ -1,5 +1,5 @@
#[cfg(doc)]
use super::ImageCompressionControl;
use super::{super::khr::Maintenance5, ImageCompressionControl};
use crate::prelude::*;
use crate::vk;
use crate::{Device, Instance};
@ -65,9 +65,13 @@ impl HostImageCopy {
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
///
/// Also available as [`Maintenance5::get_image_subresource_layout2()`]
/// when [`VK_KHR_maintenance5`] is enabled.
///
/// Also available as [`ImageCompressionControl::get_image_subresource_layout2()`]
/// when [`VK_EXT_image_compression_control`] is enabled.
///
/// [`VK_KHR_maintenance5`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html
/// [`VK_EXT_image_compression_control`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html
#[inline]
pub unsafe fn get_image_subresource_layout2(

View file

@ -1,5 +1,5 @@
#[cfg(doc)]
use super::HostImageCopy;
use super::{super::khr::Maintenance5, HostImageCopy};
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
@ -23,9 +23,13 @@ impl ImageCompressionControl {
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
///
/// Also available as [`Maintenance5::get_image_subresource_layout2()`]
/// when [`VK_KHR_maintenance5`] is enabled.
///
/// Also available as [`HostImageCopy::get_image_subresource_layout2()`]
/// when [`VK_EXT_host_image_copy`] is enabled.
///
/// [`VK_KHR_maintenance5`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html
/// [`VK_EXT_host_image_copy`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_host_image_copy.html
#[inline]
pub unsafe fn get_image_subresource_layout2(

View file

@ -3,6 +3,7 @@ use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance1.html>
#[derive(Clone)]
pub struct Maintenance1 {
handle: vk::Device,

View file

@ -3,6 +3,7 @@ use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance3.html>
#[derive(Clone)]
pub struct Maintenance3 {
handle: vk::Device,

View file

@ -3,6 +3,7 @@ use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance4.html>
#[derive(Clone)]
pub struct Maintenance4 {
handle: vk::Device,

View file

@ -0,0 +1,93 @@
#[cfg(doc)]
use super::super::ext::{HostImageCopy, ImageCompressionControl};
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_maintenance5.html>
#[derive(Clone)]
pub struct Maintenance5 {
handle: vk::Device,
fp: vk::KhrMaintenance5Fn,
}
impl Maintenance5 {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::KhrMaintenance5Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdBindIndexBuffer2KHR.html>
#[inline]
pub unsafe fn cmd_bind_index_buffer2(
&self,
command_buffer: vk::CommandBuffer,
buffer: vk::Buffer,
offset: vk::DeviceSize,
size: vk::DeviceSize,
index_type: vk::IndexType,
) {
(self.fp.cmd_bind_index_buffer2_khr)(command_buffer, buffer, offset, size, index_type)
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetRenderingAreaGranularityKHR.html>
#[inline]
pub unsafe fn get_rendering_area_granularity(
&self,
rendering_area_info: &vk::RenderingAreaInfoKHR,
) -> vk::Extent2D {
let mut granularity = mem::zeroed();
(self.fp.get_rendering_area_granularity_khr)(
self.handle,
rendering_area_info,
&mut granularity,
);
granularity
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetDeviceImageSubresourceLayoutKHR.html>
#[inline]
pub unsafe fn get_device_image_subresource_layout(
&self,
info: &vk::DeviceImageSubresourceInfoKHR,
layout: &mut vk::SubresourceLayout2KHR,
) {
(self.fp.get_device_image_subresource_layout_khr)(self.handle, info, layout)
}
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2KHR.html>
///
/// Also available as [`HostImageCopy::get_image_subresource_layout2()`]
/// when [`VK_EXT_host_image_copy`] is enabled.
///
/// Also available as [`ImageCompressionControl::get_image_subresource_layout2()`]
/// when [`VK_EXT_image_compression_control`] is enabled.
///
/// [`VK_EXT_host_image_copy`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_host_image_copy.html
/// [`VK_EXT_image_compression_control`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html
#[inline]
pub unsafe fn get_image_subresource_layout2(
&self,
image: vk::Image,
subresource: &vk::ImageSubresource2KHR,
layout: &mut vk::SubresourceLayout2KHR,
) {
(self.fp.get_image_subresource_layout2_khr)(self.handle, image, subresource, layout)
}
pub const NAME: &'static CStr = vk::KhrMaintenance5Fn::NAME;
#[inline]
pub fn fp(&self) -> &vk::KhrMaintenance5Fn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -22,6 +22,7 @@ pub use self::get_surface_capabilities2::GetSurfaceCapabilities2;
pub use self::maintenance1::Maintenance1;
pub use self::maintenance3::Maintenance3;
pub use self::maintenance4::Maintenance4;
pub use self::maintenance5::Maintenance5;
pub use self::performance_query::PerformanceQuery;
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
pub use self::present_wait::PresentWait;
@ -61,6 +62,7 @@ mod get_surface_capabilities2;
mod maintenance1;
mod maintenance3;
mod maintenance4;
mod maintenance5;
mod performance_query;
mod pipeline_executable_properties;
mod present_wait;