-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add support for VK_NV_memory_decompression
- Loading branch information
1 parent
eb17129
commit e8fee26
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |