extensions/ext: Add VK_EXT_host_image_copy (#779)
This commit is contained in:
parent
c3f322f65e
commit
95ff15ff72
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Added `VK_AMD_buffer_marker` device extension (#772)
|
- Added `VK_AMD_buffer_marker` device extension (#772)
|
||||||
- Added `VK_AMD_shader_info` device extension (#773)
|
- Added `VK_AMD_shader_info` device extension (#773)
|
||||||
- Added `VK_AMDX_shader_enqueue` device extension (#776)
|
- Added `VK_AMDX_shader_enqueue` device extension (#776)
|
||||||
|
- Added `VK_EXT_host_image_copy` device extension (#779)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
93
ash/src/extensions/ext/host_image_copy.rs
Normal file
93
ash/src/extensions/ext/host_image_copy.rs
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
#[cfg(doc)]
|
||||||
|
use super::ImageCompressionControl;
|
||||||
|
use crate::prelude::*;
|
||||||
|
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_EXT_host_image_copy.html>
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct HostImageCopy {
|
||||||
|
handle: vk::Device,
|
||||||
|
fp: vk::ExtHostImageCopyFn,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HostImageCopy {
|
||||||
|
pub fn new(instance: &Instance, device: &Device) -> Self {
|
||||||
|
let handle = device.handle();
|
||||||
|
let fp = vk::ExtHostImageCopyFn::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/vkCopyMemoryToImageEXT.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn copy_memory_to_image(
|
||||||
|
&self,
|
||||||
|
copy_memory_to_image_info: &vk::CopyMemoryToImageInfoEXT,
|
||||||
|
) -> VkResult<()> {
|
||||||
|
(self.fp.copy_memory_to_image_ext)(self.handle, copy_memory_to_image_info).result()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCopyImageToMemoryEXT.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn copy_image_to_memory(
|
||||||
|
&self,
|
||||||
|
copy_image_to_memory_info: &vk::CopyImageToMemoryInfoEXT,
|
||||||
|
) -> VkResult<()> {
|
||||||
|
(self.fp.copy_image_to_memory_ext)(self.handle, copy_image_to_memory_info).result()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCopyImageToImageEXT.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn copy_image_to_image(
|
||||||
|
&self,
|
||||||
|
copy_image_to_image_info: &vk::CopyImageToImageInfoEXT,
|
||||||
|
) -> VkResult<()> {
|
||||||
|
(self.fp.copy_image_to_image_ext)(self.handle, copy_image_to_image_info).result()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkTransitionImageLayoutEXT.html>
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn transition_image_layout(
|
||||||
|
&self,
|
||||||
|
transitions: &[vk::HostImageLayoutTransitionInfoEXT],
|
||||||
|
) -> VkResult<()> {
|
||||||
|
(self.fp.transition_image_layout_ext)(
|
||||||
|
self.handle,
|
||||||
|
transitions.len() as u32,
|
||||||
|
transitions.as_ptr(),
|
||||||
|
)
|
||||||
|
.result()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
|
||||||
|
///
|
||||||
|
/// Also available as [`ImageCompressionControl::get_image_subresource_layout2()`]
|
||||||
|
/// when [`VK_EXT_image_compression_control`] is enabled.
|
||||||
|
///
|
||||||
|
/// [`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::ImageSubresource2EXT,
|
||||||
|
layout: &mut vk::SubresourceLayout2EXT,
|
||||||
|
) {
|
||||||
|
(self.fp.get_image_subresource_layout2_ext)(self.handle, image, subresource, layout)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const NAME: &'static CStr = vk::ExtHostImageCopyFn::NAME;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn fp(&self) -> &vk::ExtHostImageCopyFn {
|
||||||
|
&self.fp
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn device(&self) -> vk::Device {
|
||||||
|
self.handle
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
#[cfg(doc)]
|
||||||
|
use super::HostImageCopy;
|
||||||
use crate::vk;
|
use crate::vk;
|
||||||
use crate::{Device, Instance};
|
use crate::{Device, Instance};
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
@ -20,6 +22,11 @@ impl ImageCompressionControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
|
/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkGetImageSubresourceLayout2EXT.html>
|
||||||
|
///
|
||||||
|
/// Also available as [`HostImageCopy::get_image_subresource_layout2()`]
|
||||||
|
/// when [`VK_EXT_host_image_copy`] is enabled.
|
||||||
|
///
|
||||||
|
/// [`VK_EXT_host_image_copy`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_host_image_copy.html
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_image_subresource_layout2(
|
pub unsafe fn get_image_subresource_layout2(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -12,6 +12,7 @@ pub use self::extended_dynamic_state2::ExtendedDynamicState2;
|
||||||
pub use self::extended_dynamic_state3::ExtendedDynamicState3;
|
pub use self::extended_dynamic_state3::ExtendedDynamicState3;
|
||||||
pub use self::full_screen_exclusive::FullScreenExclusive;
|
pub use self::full_screen_exclusive::FullScreenExclusive;
|
||||||
pub use self::headless_surface::HeadlessSurface;
|
pub use self::headless_surface::HeadlessSurface;
|
||||||
|
pub use self::host_image_copy::HostImageCopy;
|
||||||
pub use self::image_compression_control::ImageCompressionControl;
|
pub use self::image_compression_control::ImageCompressionControl;
|
||||||
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
|
pub use self::image_drm_format_modifier::ImageDrmFormatModifier;
|
||||||
pub use self::mesh_shader::MeshShader;
|
pub use self::mesh_shader::MeshShader;
|
||||||
|
@ -36,6 +37,7 @@ mod extended_dynamic_state2;
|
||||||
mod extended_dynamic_state3;
|
mod extended_dynamic_state3;
|
||||||
mod full_screen_exclusive;
|
mod full_screen_exclusive;
|
||||||
mod headless_surface;
|
mod headless_surface;
|
||||||
|
mod host_image_copy;
|
||||||
mod image_compression_control;
|
mod image_compression_control;
|
||||||
mod image_drm_format_modifier;
|
mod image_drm_format_modifier;
|
||||||
mod mesh_shader;
|
mod mesh_shader;
|
||||||
|
|
Loading…
Reference in a new issue