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/khr: Add VK_KHR_cooperative_matrix #782

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `VK_EXT_host_image_copy` device extension (#779)
- Added `VK_KHR_maintenance5` device extension (#780)
- Added `VK_NV_device_generated_commands_compute` device extension (#781)
- Added `VK_KHR_cooperative_matrix` instance extension (#782)

### Changed

Expand Down
45 changes: 45 additions & 0 deletions ash/src/extensions/khr/cooperative_matrix.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use crate::prelude::*;
use crate::vk;
use crate::{Entry, Instance};
use std::ffi::CStr;
use std::mem;

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

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR.html>
#[inline]
pub unsafe fn get_physical_device_cooperative_matrix_properties(
&self,
physical_device: vk::PhysicalDevice,
) -> VkResult<Vec<vk::CooperativeMatrixPropertiesKHR>> {
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
}
}
2 changes: 2 additions & 0 deletions ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -41,6 +42,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;
Expand Down
Loading