diff --git a/Changelog.md b/Changelog.md index d8ac0961a..fed7a5b14 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `VK_ANDROID_external_memory_android_hardware_buffer` device extension (#769) - Added `VK_AMD_buffer_marker` device extension (#772) - Added `VK_AMD_shader_info` device extension (#773) +- Added `VK_KHR_cooperative_matrix` instance extension (#782) ### Changed diff --git a/ash/src/extensions/khr/cooperative_matrix.rs b/ash/src/extensions/khr/cooperative_matrix.rs new file mode 100644 index 000000000..19b332112 --- /dev/null +++ b/ash/src/extensions/khr/cooperative_matrix.rs @@ -0,0 +1,45 @@ +use crate::prelude::*; +use crate::vk; +use crate::{Entry, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[derive(Clone)] +pub struct CooperativeMatrix { + fp: vk::KhrCooperativeMatrixFn, +} + +impl CooperativeMatrix { + pub fn new(entry: &Entry, instance: &Instance) -> Self { + let handle = instance.handle(); + let fp = vk::KhrCooperativeMatrixFn::load(|name| unsafe { + mem::transmute(entry.get_instance_proc_addr(handle, name.as_ptr())) + }); + Self { fp } + } + + /// + #[inline] + pub unsafe fn get_physical_device_cooperative_matrix_properties( + &self, + physical_device: vk::PhysicalDevice, + ) -> VkResult> { + read_into_defaulted_vector(|count, data| { + (self + .fp + .get_physical_device_cooperative_matrix_properties_khr)( + physical_device, + count, + data, + ) + }) + } + + pub const NAME: &'static CStr = vk::KhrCooperativeMatrixFn::NAME; + + #[inline] + pub fn fp(&self) -> &vk::KhrCooperativeMatrixFn { + &self.fp + } +} diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index ff84d0dbf..b90952cec 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -1,6 +1,7 @@ pub use self::acceleration_structure::AccelerationStructure; pub use self::android_surface::AndroidSurface; pub use self::buffer_device_address::BufferDeviceAddress; +pub use self::cooperative_matrix::CooperativeMatrix; pub use self::copy_commands2::CopyCommands2; pub use self::create_render_pass2::CreateRenderPass2; pub use self::deferred_host_operations::DeferredHostOperations; @@ -40,6 +41,7 @@ pub use self::xlib_surface::XlibSurface; mod acceleration_structure; mod android_surface; mod buffer_device_address; +mod cooperative_matrix; mod copy_commands2; mod create_render_pass2; mod deferred_host_operations;