diff --git a/Changelog.md b/Changelog.md index 7742bdefd..ceb2c2252 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added `VK_NV_memory_decompression` device extension (#761) - Added `Handle::is_null()` to allow checking if a handle is a `NULL` value (#694) - Allow building `Entry`/`Instance`/`Device` from handle+fns (see their `from_parts_1_x()` associated functions) (#748) - Update Vulkan-Headers to 1.3.254 (#760) diff --git a/ash/src/extensions/nv/memory_decompression.rs b/ash/src/extensions/nv/memory_decompression.rs new file mode 100644 index 000000000..5e2092c0a --- /dev/null +++ b/ash/src/extensions/nv/memory_decompression.rs @@ -0,0 +1,46 @@ +use crate::{vk, Device, Instance}; +use std::mem; + +/// +#[derive(Clone)] +pub struct MemoryDecompression { + fp: vk::NvMemoryDecompressionFn, +} + +impl MemoryDecompression { + pub fn new(instance: &Instance, device: &Device) -> Self { + let fp = vk::NvMemoryDecompressionFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// + pub unsafe fn cmd_decompress_memory( + &self, + command_buffer: vk::CommandBuffer, + decompress_memory_regions: &[vk::DecompressMemoryRegionNV], + ) { + (self.fp.cmd_decompress_memory_nv)( + command_buffer, + decompress_memory_regions.len() as u32, + decompress_memory_regions.as_ptr(), + ) + } + + /// + pub unsafe fn cmd_decompress_memory_indirect_count( + &self, + command_buffer: vk::CommandBuffer, + indirect_commands_address: vk::DeviceAddress, + indirect_commands_count_address: vk::DeviceAddress, + stride: u32, + ) { + (self.fp.cmd_decompress_memory_indirect_count_nv)( + command_buffer, + indirect_commands_address, + indirect_commands_count_address, + stride, + ) + } +} diff --git a/ash/src/extensions/nv/mod.rs b/ash/src/extensions/nv/mod.rs index bfde37a55..4f6c3fabf 100644 --- a/ash/src/extensions/nv/mod.rs +++ b/ash/src/extensions/nv/mod.rs @@ -1,9 +1,11 @@ pub use self::coverage_reduction_mode::CoverageReductionMode; pub use self::device_diagnostic_checkpoints::DeviceDiagnosticCheckpoints; +pub use self::memory_decompression::MemoryDecompression; pub use self::mesh_shader::MeshShader; pub use self::ray_tracing::RayTracing; mod coverage_reduction_mode; mod device_diagnostic_checkpoints; +mod memory_decompression; mod mesh_shader; mod ray_tracing;