extensions/ext: Add VK_EXT_image_compression_control device extension (#621)

This commit is contained in:
Marijn Suijten 2022-07-03 22:09:06 +02:00
parent 89f3271463
commit 0d4f2ba23a
3 changed files with 50 additions and 0 deletions

View file

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_EXT_sample_locations` device extension (#616)
- Added `VK_NV_coverage_reduction_mode` device extension (#617)
- Added `VK_KHR_ray_tracing_maintenance1` device extension (#620)
- Added `VK_EXT_image_compression_control` device extension (#621)
- Added new functions to `VK_KHR_swapchain`, available since Vulkan 1.1 (#629)
- Added `VK_KHR_device_group_creation` instance extension (#630)
- Added `VK_KHR_device_group` device extension (#631)

View file

@ -0,0 +1,47 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_EXT_image_compression_control.html>
#[derive(Clone)]
pub struct ImageCompressionControl {
handle: vk::Device,
fp: vk::ExtImageCompressionControlFn,
}
impl ImageCompressionControl {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::ExtImageCompressionControlFn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { handle, fp }
}
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
#[inline]
pub unsafe fn get_image_subresource_layout2(
&self,
image: vk::Image,
subresource: &vk::ImageSubresource2EXT,
layout: &mut vk::SubresourceLayout2EXT,
) {
(self.fp.get_image_subresource_layout2_ext)(self.handle, image, subresource, layout)
}
#[inline]
pub const fn name() -> &'static CStr {
vk::ExtImageCompressionControlFn::name()
}
#[inline]
pub fn fp(&self) -> &vk::ExtImageCompressionControlFn {
&self.fp
}
#[inline]
pub fn device(&self) -> vk::Device {
self.handle
}
}

View file

@ -9,6 +9,7 @@ pub use self::extended_dynamic_state::ExtendedDynamicState;
pub use self::extended_dynamic_state2::ExtendedDynamicState2;
pub use self::full_screen_exclusive::FullScreenExclusive;
pub use self::headless_surface::HeadlessSurface;
pub use self::image_compression_control::ImageCompressionControl;
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
pub use self::metal_surface::MetalSurface;
pub use self::physical_device_drm::PhysicalDeviceDrm;
@ -27,6 +28,7 @@ mod extended_dynamic_state;
mod extended_dynamic_state2;
mod full_screen_exclusive;
mod headless_surface;
mod image_compression_control;
mod image_drm_format_modifier;
mod metal_surface;
mod physical_device_drm;