Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions/nv: Add VK_NV_memory_decompression #761

Merged
merged 3 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
✨ Add support for VK_NV_memory_decompression
  • Loading branch information
BeastLe9enD committed Jun 18, 2023
commit e8fee263616349106a74ad1c8f6eb20f0bdd231f
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
46 changes: 46 additions & 0 deletions ash/src/extensions/nv/memory_decompression.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use crate::{vk, Device, Instance};
use std::mem;

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_NV_memory_decompression.html>
#[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 }
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDecompressMemoryNV.html>
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(),
)
}

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdDecompressMemoryIndirectCountNV.html>
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,
)
}
}
2 changes: 2 additions & 0 deletions ash/src/extensions/nv/mod.rs
Original file line number Diff line number Diff line change
@@ -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;