From ef8fedcf8814ffc8f96f6c763e0d777438437afa Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Mon, 25 Mar 2024 20:44:15 +0100 Subject: [PATCH] extensions/khr: Add VK_KHR_dynamic_rendering_local_read extension (#888) --- Changelog.md | 1 + .../khr/dynamic_rendering_local_read.rs | 44 +++++++++++++++++++ ash/src/extensions/khr/mod.rs | 1 + 3 files changed, 46 insertions(+) create mode 100644 ash/src/extensions/khr/dynamic_rendering_local_read.rs diff --git a/Changelog.md b/Changelog.md index 7fcebfd7c..8b4d5d14c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `#[must_use]` to Vulkan structs to make it more clear that they are moved by the builder pattern (#845) - Added `load_with()` function on `Device` and `Instance` for providing custom `get_xxx_proc_addr()` implementations (#846) - Added `Send`/`Sync` to all Vulkan structs (#869) +- Added `VK_KHR_dynamic_rendering_local_read` device extension (#888) ### Changed diff --git a/ash/src/extensions/khr/dynamic_rendering_local_read.rs b/ash/src/extensions/khr/dynamic_rendering_local_read.rs new file mode 100644 index 000000000..116afb1c5 --- /dev/null +++ b/ash/src/extensions/khr/dynamic_rendering_local_read.rs @@ -0,0 +1,44 @@ +//! + +use crate::vk; +use core::mem; +pub use vk::khr::dynamic_rendering_local_read::NAME; + +#[derive(Clone)] +pub struct Device { + fp: vk::khr::dynamic_rendering_local_read::DeviceFn, +} + +impl Device { + pub fn new(instance: &crate::Instance, device: &crate::Device) -> Self { + let fp = vk::khr::dynamic_rendering_local_read::DeviceFn::load(|name| unsafe { + mem::transmute(instance.get_device_proc_addr(device.handle(), name.as_ptr())) + }); + Self { fp } + } + + /// + #[inline] + pub unsafe fn cmd_set_rendering_attachment_locations( + &self, + command_buffer: vk::CommandBuffer, + location_info: &vk::RenderingAttachmentLocationInfoKHR<'_>, + ) { + (self.fp.cmd_set_rendering_attachment_locations_khr)(command_buffer, location_info) + } + + /// + #[inline] + pub unsafe fn cmd_set_rendering_input_attachment_indices( + &self, + command_buffer: vk::CommandBuffer, + location_info: &vk::RenderingInputAttachmentIndexInfoKHR<'_>, + ) { + (self.fp.cmd_set_rendering_input_attachment_indices_khr)(command_buffer, location_info) + } + + #[inline] + pub fn fp(&self) -> &vk::khr::dynamic_rendering_local_read::DeviceFn { + &self.fp + } +} diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index 20ac43db9..bab6b204e 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -11,6 +11,7 @@ pub mod display; pub mod display_swapchain; pub mod draw_indirect_count; pub mod dynamic_rendering; +pub mod dynamic_rendering_local_read; pub mod external_fence_fd; pub mod external_fence_win32; pub mod external_memory_fd;