Skip to content

Commit

Permalink
extensions/khr: Add VK_KHR_dynamic_rendering_local_read extension (#888)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 authored Mar 25, 2024
1 parent 9f712c5 commit ef8fedc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
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

0 comments on commit ef8fedc

Please sign in to comment.