extensions/khr: Add VK_KHR_cooperative_matrix (#782)

This commit is contained in:
Marijn Suijten 2023-08-14 16:49:32 +02:00 committed by GitHub
parent 3fa908c70a
commit 39dc6d607c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 0 deletions

View file

@ -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_EXT_host_image_copy` device extension (#779)
- Added `VK_KHR_maintenance5` device extension (#780) - Added `VK_KHR_maintenance5` device extension (#780)
- Added `VK_NV_device_generated_commands_compute` device extension (#781) - Added `VK_NV_device_generated_commands_compute` device extension (#781)
- Added `VK_KHR_cooperative_matrix` instance extension (#782)
### Changed ### Changed

View file

@ -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
}
}

View file

@ -1,6 +1,7 @@
pub use self::acceleration_structure::AccelerationStructure; pub use self::acceleration_structure::AccelerationStructure;
pub use self::android_surface::AndroidSurface; pub use self::android_surface::AndroidSurface;
pub use self::buffer_device_address::BufferDeviceAddress; pub use self::buffer_device_address::BufferDeviceAddress;
pub use self::cooperative_matrix::CooperativeMatrix;
pub use self::copy_commands2::CopyCommands2; pub use self::copy_commands2::CopyCommands2;
pub use self::create_render_pass2::CreateRenderPass2; pub use self::create_render_pass2::CreateRenderPass2;
pub use self::deferred_host_operations::DeferredHostOperations; pub use self::deferred_host_operations::DeferredHostOperations;
@ -41,6 +42,7 @@ pub use self::xlib_surface::XlibSurface;
mod acceleration_structure; mod acceleration_structure;
mod android_surface; mod android_surface;
mod buffer_device_address; mod buffer_device_address;
mod cooperative_matrix;
mod copy_commands2; mod copy_commands2;
mod create_render_pass2; mod create_render_pass2;
mod deferred_host_operations; mod deferred_host_operations;