From 1028ed03724c67b0190ea8d19e43c98ab9758e6b Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 10 May 2022 15:09:20 +0200 Subject: [PATCH] extensions/khr: Add VK_KHR_ray_tracing_maintenance1 device extension --- Changelog.md | 1 + ash/src/extensions/khr/mod.rs | 2 + .../khr/ray_tracing_maintenance1.rs | 42 +++++++++++++++++++ .../extensions/khr/ray_tracing_pipeline.rs | 2 + generator/Vulkan-Headers | 2 +- 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 ash/src/extensions/khr/ray_tracing_maintenance1.rs diff --git a/Changelog.md b/Changelog.md index 0e42bd44a..fd787ecd6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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) diff --git a/ash/src/extensions/khr/mod.rs b/ash/src/extensions/khr/mod.rs index babb0626f..ea809b43d 100644 --- a/ash/src/extensions/khr/mod.rs +++ b/ash/src/extensions/khr/mod.rs @@ -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; @@ -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; diff --git a/ash/src/extensions/khr/ray_tracing_maintenance1.rs b/ash/src/extensions/khr/ray_tracing_maintenance1.rs new file mode 100644 index 000000000..a5159ad39 --- /dev/null +++ b/ash/src/extensions/khr/ray_tracing_maintenance1.rs @@ -0,0 +1,42 @@ +use crate::vk; +use crate::{Device, Instance}; +use std::ffi::CStr; +use std::mem; + +/// +#[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 } + } + + /// + /// + /// `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 + } +} diff --git a/ash/src/extensions/khr/ray_tracing_pipeline.rs b/ash/src/extensions/khr/ray_tracing_pipeline.rs index 0661fb506..9d367e5b2 100644 --- a/ash/src/extensions/khr/ray_tracing_pipeline.rs +++ b/ash/src/extensions/khr/ray_tracing_pipeline.rs @@ -122,6 +122,8 @@ impl RayTracingPipeline { } /// + /// + /// `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, diff --git a/generator/Vulkan-Headers b/generator/Vulkan-Headers index 2c823b7f2..23842a31d 160000 --- a/generator/Vulkan-Headers +++ b/generator/Vulkan-Headers @@ -1 +1 @@ -Subproject commit 2c823b7f27590ec0a489f7fbe14b154e13fa5cfb +Subproject commit 23842a31df9c9c2b3bc7c6c2bb56044bc5e51c05