gfx-rs/wgpu · error
Feature `EXPERIMENTAL_RAY_TRACING` not enabled
Error message
Feature `EXPERIMENTAL_RAY_TRACING` not enabled
What it means
`trace_rays` expects `device.extension_fns.ray_tracing` to be present, using `.expect("Feature `EXPERIMENTAL_RAY_TRACING` not enabled")`. Note the different feature name: this is gated on wgpu's `EXPERIMENTAL_RAY_TRACING` flag. Dispatching a ray tracing pipeline without that experimental feature enabled at device creation — or without the Vulkan ray tracing functions loaded — panics here.
Source
Thrown at wgpu-hal/src/vulkan/command.rs:1429
if self.rpass_debug_marker_active {
unsafe { self.end_debug_marker() };
self.rpass_debug_marker_active = false
}
}
unsafe fn trace_rays(
&mut self,
count: [u32; 3],
ray_generation_group_data: crate::PipelineGroupData<super::Buffer>,
miss_group_data: crate::PipelineGroupData<super::Buffer>,
intersection_group_data: crate::PipelineGroupData<super::Buffer>,
) {
let ray_tracing_functions = self
.device
.extension_fns
.ray_tracing
.as_ref()
.expect("Feature `EXPERIMENTAL_RAY_TRACING` not enabled");
let ray_tracing_pipeline_functions = self
.device
.extension_fns
.ray_tracing_pipelines
.as_ref()
.expect("Feature `EXPERIMENTAL_RAY_TRACING_PIPELINES` not enabled");
let get_device_address = |buffer: &super::Buffer| unsafe {
ray_tracing_functions
.buffer_device_address
.get_buffer_device_address(
&vk::BufferDeviceAddressInfo::default().buffer(buffer.raw),
)
};
unsafe {
ray_tracing_pipeline_functions.cmd_trace_rays(View on GitHub (pinned to 3e11ff59bf)
Solutions
- Add `Features::EXPERIMENTAL_RAY_TRACING` to required_features when creating the device
- Re-check which feature flag your wgpu version requires (RAY_TRACING vs EXPERIMENTAL_RAY_TRACING) and match it to the API you call
- Verify adapter support for VK_KHR_ray_tracing_pipeline and that the version of wgpu you use exposes the experimental feature
- Fall back to compute-based ray tracing if the adapter lacks RT support
Example fix
// before
let device = adapter.create_device(&DeviceDescriptor {
required_features: wgpu::Features::RAY_TRACING,
..Default::default()
})?;
// after: experimental pipelines need the experimental flag
let device = adapter.create_device(&DeviceDescriptor {
required_features: wgpu::Features::EXPERIMENTAL_RAY_TRACING,
..Default::default()
})?; Defensive patterns
Strategy: validation
Validate before calling
if !adapter.features().contains(wgpu::Features::EXPERIMENTAL_RAY_TRACING) {
return Err(Error::ExperimentalRayTracingUnsupported);
}
let device = adapter.create_device(&DeviceDescriptor {
required_features: wgpu::Features::EXPERIMENTAL_RAY_TRACING,
..Default::default()
})?; Type guard
fn supports_experimental_ray_tracing(features: wgpu::Features) -> bool {
features.contains(wgpu::Features::EXPERIMENTAL_RAY_TRACING)
} Try / catch
// check before dispatching rays; do not rely on catching the panic:
if !device.features().contains(wgpu::Features::EXPERIMENTAL_RAY_TRACING) {
return Err(Error::ExperimentalRayTracingUnsupported);
}
encoder.trace_rays(...); Prevention
- Enable Features::EXPERIMENTAL_RAY_TRACING (not just RAY_TRACING) when using trace_rays
- Track wgpu changelogs: experimental feature names change between versions
- Check adapter features and driver support for VK_KHR_ray_tracing_pipeline
- Provide a compute-shader fallback when experimental RT is unavailable
When it happens
Trigger: Calling `trace_rays` (vkCmdTraceRays path) on a device created without `Features::EXPERIMENTAL_RAY_TRACING` in required_features, or where `extension_fns.ray_tracing` is None (extensions/functions not available).
Common situations: Using wgpu's experimental ray tracing pipeline API while forgetting the EXPERIMENTAL_RAY_TRACING feature bit (distinct from the stable RAY_TRACING one); adapters/driver combos where ray tracing extensions fail to load; code updated for the new feature name but devices still created with the old set.
Related errors
- Feature `RAY_TRACING` not enabled
- Buffers are required to build acceleration structures
- This vulkan device is affected by [#8333](https://github.com
- vkFreeDescriptorSets error: {err}, please report this error
- {}
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/b8c3779637754069.
Report an issue: GitHub.