diff --git a/examples/ray-tracing/main.rs b/examples/ray-tracing/main.rs index bd861fe0c31..73cc2c00695 100644 --- a/examples/ray-tracing/main.rs +++ b/examples/ray-tracing/main.rs @@ -150,8 +150,7 @@ fn main() { let adapter = adapters.remove(0); - let required_features = - hal::Features::ACCELERATION_STRUCTURE | hal::Features::RAY_TRACING_PIPELINE; + let required_features = hal::Features::ACCELERATION_STRUCTURE; // | hal::Features::RAY_QUERY; assert!(adapter .physical_device diff --git a/src/backend/vulkan/src/conv.rs b/src/backend/vulkan/src/conv.rs index 833753e099c..381a1a0dd1e 100644 --- a/src/backend/vulkan/src/conv.rs +++ b/src/backend/vulkan/src/conv.rs @@ -592,19 +592,6 @@ pub(crate) fn map_device_features( } else { None }, - ray_tracing_pipeline: if features.contains(Features::RAY_TRACING_PIPELINE) { - Some( - vk::PhysicalDeviceRayTracingPipelineFeaturesKHR::builder() - .ray_tracing_pipeline(features.contains(Features::RAY_TRACING_PIPELINE)) - // .ray_tracing_pipeline_shader_group_handle_capture_replay() - // .ray_tracing_pipeline_shader_group_handle_capture_replay_mixed() - // .ray_tracing_pipeline_trace_rays_indirect() - // .ray_traversal_primitive_culling() - .build(), - ) - } else { - None - }, } } diff --git a/src/backend/vulkan/src/lib.rs b/src/backend/vulkan/src/lib.rs index f46c97725ee..e4541940e59 100644 --- a/src/backend/vulkan/src/lib.rs +++ b/src/backend/vulkan/src/lib.rs @@ -32,7 +32,7 @@ use ash::{ extensions::{ self, ext::{DebugReport, DebugUtils}, - khr::{AccelerationStructure, DrawIndirectCount, RayTracingPipeline, Swapchain}, + khr::{AccelerationStructure, DrawIndirectCount, RayQuery, Swapchain}, nv::MeshShader, }, version::{DeviceV1_0, EntryV1_0, InstanceV1_0}, @@ -684,7 +684,6 @@ pub struct DeviceCreationFeatures { imageless_framebuffers: Option, buffer_device_address: Option, acceleration_structure: Option, - ray_tracing_pipeline: Option, } impl adapter::PhysicalDevice for PhysicalDevice { @@ -776,12 +775,11 @@ impl adapter::PhysicalDevice for PhysicalDevice { enabled_extensions.push(extensions::khr::DeferredHostOperations::name()); } - if requested_features.contains(Features::RAY_TRACING_PIPELINE) { - enabled_extensions.push(RayTracingPipeline::name()); + if requested_features.contains(Features::RAY_QUERY) { + enabled_extensions.push(RayQuery::name()); - // TODO better handling of extension dependencies? These are required by VK_KHR_ray_tracing_pipeline + // TODO better handling of extension dependencies? These are required by VK_KHR_ray_query enabled_extensions.push(vk::KhrSpirv14Fn::name()); - enabled_extensions.push(vk::KhrShaderFloatControlsFn::name()); } enabled_extensions @@ -844,13 +842,6 @@ impl adapter::PhysicalDevice for PhysicalDevice { info }; - let info = - if let Some(ref mut ray_tracing_pipeline) = enabled_features.ray_tracing_pipeline { - info.push_next(ray_tracing_pipeline) - } else { - info - }; - match self.instance.inner.create_device(self.handle, &info, None) { Ok(device) => device, Err(e) => { @@ -1069,7 +1060,7 @@ impl adapter::PhysicalDevice for PhysicalDevice { let mut descriptor_indexing_features = None; let mut buffer_device_address = None; let mut acceleration_structure_features = None; - let mut ray_tracing_pipeline_features = None; + let mut ray_query_features = None; let features = if let Some(ref get_device_properties) = self.instance.get_physical_device_properties { @@ -1103,11 +1094,10 @@ impl adapter::PhysicalDevice for PhysicalDevice { mut_ref.p_next = mem::replace(&mut features2.p_next, mut_ref as *mut _ as *mut _); } - if self.supports_extension(RayTracingPipeline::name()) { - ray_tracing_pipeline_features = - Some(vk::PhysicalDeviceRayTracingPipelineFeaturesKHR::builder().build()); + if self.supports_extension(RayQuery::name()) { + ray_query_features = Some(vk::PhysicalDeviceRayQueryFeaturesKHR::builder().build()); - let mut_ref = ray_tracing_pipeline_features.as_mut().unwrap(); + let mut_ref = ray_query_features.as_mut().unwrap(); mut_ref.p_next = mem::replace(&mut features2.p_next, mut_ref as *mut _ as *mut _); } @@ -1346,26 +1336,9 @@ impl adapter::PhysicalDevice for PhysicalDevice { // TODO } } - if let Some(ray_tracing_pipeline_features) = ray_tracing_pipeline_features { - if ray_tracing_pipeline_features.ray_tracing_pipeline == vk::TRUE { - bits |= Features::RAY_TRACING_PIPELINE; - } - if ray_tracing_pipeline_features.ray_tracing_pipeline_shader_group_handle_capture_replay - == vk::TRUE - { - // bits |= Features::RAY_TRACING_PIPELINE_SHADER_GROUP_HANDLE_CAPTURE_REPLAY; - } - if ray_tracing_pipeline_features - .ray_tracing_pipeline_shader_group_handle_capture_replay_mixed - == vk::TRUE - { - // bits |= Features::RAY_TRACING_PIPELINE_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_MIXED; - } - if ray_tracing_pipeline_features.ray_tracing_pipeline_trace_rays_indirect == vk::TRUE { - // bits |= Features::RAY_TRACING_PIPELINE_TRACE_RAYS_INDIRECT; - } - if ray_tracing_pipeline_features.ray_traversal_primitive_culling == vk::TRUE { - // bits |= Features::RAY_TRAVERSAL_PRIMITIVE_CULLING; + if let Some(ray_query_features) = ray_query_features { + if ray_query_features.ray_query == vk::TRUE { + bits |= Features::RAY_QUERY; } } if let Some(buffer_device_address) = buffer_device_address { diff --git a/src/hal/src/lib.rs b/src/hal/src/lib.rs index 7383f7ddb31..8d6a0336528 100644 --- a/src/hal/src/lib.rs +++ b/src/hal/src/lib.rs @@ -286,11 +286,8 @@ bitflags! { // TODO this is not supported for other resource types yet // const ACCELERATION_STRUCTURE_UPDATE_AFTER_BIND = 0x0010 << 112; - /// - const RAY_TRACING_PIPELINE = 0x0020 << 112; - - // /// - // const RAY_QUERY = 0x0040 << 112; + /// Support ray query functionality in shaders. + const RAY_QUERY = 0x0020 << 112; } }