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_dynamic_rendering_local_read extension #888

Merged
merged 1 commit into from
Mar 25, 2024
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 @@ -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

Expand Down
44 changes: 44 additions & 0 deletions ash/src/extensions/khr/dynamic_rendering_local_read.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//! <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dynamic_rendering_local_read.html>

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

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

/// <https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkCmdSetRenderingInputAttachmentIndicesKHR.html>
#[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
}
}
1 change: 1 addition & 0 deletions ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down