{"record":{"id":"2d26be308a5c99c8","repo":"gfx-rs/wgpu","slug":"feature-ray-tracing-not-enabled","errorCode":null,"errorMessage":"Feature `RAY_TRACING` not enabled","messagePattern":"Feature `RAY_TRACING` not enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/vulkan/command.rs","lineNumber":496,"sourceCode":"            self.device.raw.cmd_write_timestamp(\n                self.active,\n                vk::PipelineStageFlags::BOTTOM_OF_PIPE,\n                set.raw,\n                index,\n            )\n        };\n    }\n    unsafe fn read_acceleration_structure_compact_size(\n        &mut self,\n        acceleration_structure: &super::AccelerationStructure,\n        buffer: &super::Buffer,\n    ) {\n        let ray_tracing_functions = self\n            .device\n            .extension_fns\n            .ray_tracing\n            .as_ref()\n            .expect(\"Feature `RAY_TRACING` not enabled\");\n        let query_pool = acceleration_structure\n            .compacted_size_query\n            .as_ref()\n            .unwrap();\n        unsafe {\n            self.device\n                .raw\n                .cmd_reset_query_pool(self.active, *query_pool, 0, 1);\n            ray_tracing_functions\n                .acceleration_structure\n                .cmd_write_acceleration_structures_properties(\n                    self.active,\n                    &[acceleration_structure.raw],\n                    vk::QueryType::ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR,\n                    *query_pool,\n                    0,\n                );\n            self.device.raw.cmd_copy_query_pool_results(","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/vulkan/command.rs#L478-L514","documentation":"`read_acceleration_structure_compact_size` calls `.expect(\"Feature `RAY_TRACING` not enabled\")` on `device.extension_fns.ray_tracing`. This Option is only `Some` when the Vulkan device was created with the ray tracing extensions (e.g. VK_KHR_acceleration_structure/KHR_ray_query) and their function pointers were loaded. Panicking here means a compact-size query was requested for an acceleration structure without ray tracing support being enabled on the device.","triggerScenarios":"Calling `CommandEncoder::read_acceleration_structure_compact_size` (wgpu's ray-tracing API) on a device created without `Features::RAY_TRACING` (or where `extension_fns.ray_tracing` was None because extensions/functions were unavailable at device init).","commonSituations":"Using wgpu's experimental ray tracing API on a device/GPU/driver without VK_KHR_acceleration_structure or ray query support; forgetting to request `Features::RAY_TRACING` in `DeviceDescriptor`; running on adapters where the feature was filtered out by `adapter_features`.","solutions":["Request `Features::RAY_TRACING` in the DeviceDescriptor and confirm `Adapter::features()` advertises it before enabling","Check `adapter.features().contains(Features::RAY_TRACING)` before creating a device or calling compact-size queries","Ensure the Vulkan driver/GPU supports VK_KHR_acceleration_structure and VK_KHR_ray_query (RTX-class hardware, up-to-date driver)","Gate ray-tracing code paths behind a capability check and provide a non-RT fallback"],"exampleFix":"// before: panics if RT not enabled\ncoder.read_acceleration_structure_compact_size(as_gpu, &query);\n// after: guard on the feature\nif device.features().contains(wgpu::Features::RAY_TRACING) {\n    encoder.read_acceleration_structure_compact_size(as_gpu, &query);\n}","handlingStrategy":"validation","validationCode":"if !adapter.features().contains(wgpu::Features::RAY_TRACING) {\n    return Err(Error::RayTracingUnsupported);\n}","typeGuard":"fn supports_ray_tracing(features: wgpu::Features) -> bool {\n    features.contains(wgpu::Features::RAY_TRACING)\n}","tryCatchPattern":"// panic-based; avoid catching. Assert capability at device creation instead:\nassert!(device.features().contains(wgpu::Features::RAY_TRACING),\n        \"ray tracing required\");","preventionTips":["Always request Features::RAY_TRACING in required_features when using acceleration structures","Check adapter.features() before device creation and pick a compatible adapter","Gate RT code paths on a runtime capability flag","Keep GPU drivers updated to get VK_KHR_acceleration_structure/ray_query"],"tags":["vulkan","ray-tracing","feature-not-enabled","panic"],"backgroundTag":"required-feature-not-enabled","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}