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_ray_tracing_maintenance1 device extension #620

Merged
merged 1 commit into from
Jul 3, 2022
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 @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update Vulkan-Headers to 1.3.219 (#605, #608, #619)
- Added `VK_EXT_sample_locations` device extension (#616)
- Added `VK_NV_coverage_reduction_mode` device extension (#617)
- Added `VK_KHR_ray_tracing_maintenance1` device extension (#620)
- Added new functions to `VK_KHR_swapchain`, available since Vulkan 1.1 (#629)
- Added `VK_KHR_device_group_creation` instance extension (#630)
- Added `VK_KHR_device_group` device extension (#631)
Expand Down
2 changes: 2 additions & 0 deletions ash/src/extensions/khr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub use self::maintenance4::Maintenance4;
pub use self::pipeline_executable_properties::PipelineExecutableProperties;
pub use self::present_wait::PresentWait;
pub use self::push_descriptor::PushDescriptor;
pub use self::ray_tracing_maintenance1::RayTracingMaintenance1;
pub use self::ray_tracing_pipeline::RayTracingPipeline;
pub use self::surface::Surface;
pub use self::swapchain::Swapchain;
Expand Down Expand Up @@ -62,6 +63,7 @@ mod maintenance4;
mod pipeline_executable_properties;
mod present_wait;
mod push_descriptor;
mod ray_tracing_maintenance1;
mod ray_tracing_pipeline;
mod surface;
mod swapchain;
Expand Down
42 changes: 42 additions & 0 deletions ash/src/extensions/khr/ray_tracing_maintenance1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use crate::vk;
use crate::{Device, Instance};
use std::ffi::CStr;
use std::mem;

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/VK_KHR_ray_tracing_maintenance1.html>
#[derive(Clone)]
pub struct RayTracingMaintenance1 {
fp: vk::KhrRayTracingMaintenance1Fn,
}

impl RayTracingMaintenance1 {
pub fn new(instance: &Instance, device: &Device) -> Self {
let handle = device.handle();
let fp = vk::KhrRayTracingMaintenance1Fn::load(|name| unsafe {
mem::transmute(instance.get_device_proc_addr(handle, name.as_ptr()))
});
Self { fp }
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirect2KHR.html>
///
/// `indirect_device_address` is a buffer device address which is a pointer to a [`vk::TraceRaysIndirectCommand2KHR`] structure containing the trace ray parameters.
#[inline]
pub unsafe fn cmd_trace_rays_indirect2(
&self,
command_buffer: vk::CommandBuffer,
indirect_device_address: vk::DeviceAddress,
) {
(self.fp.cmd_trace_rays_indirect2_khr)(command_buffer, indirect_device_address);
}

#[inline]
pub const fn name() -> &'static CStr {
vk::KhrRayTracingMaintenance1Fn::name()
}

#[inline]
pub fn fp(&self) -> &vk::KhrRayTracingMaintenance1Fn {
&self.fp
}
}
2 changes: 2 additions & 0 deletions ash/src/extensions/khr/ray_tracing_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ impl RayTracingPipeline {
}

/// <https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkCmdTraceRaysIndirectKHR.html>
///
/// `indirect_device_address` is a buffer device address which is a pointer to a [`vk::TraceRaysIndirectCommandKHR`] structure containing the trace ray parameters.
pub unsafe fn cmd_trace_rays_indirect(
&self,
command_buffer: vk::CommandBuffer,
Expand Down