{"record":{"id":"f10eb461a3865483","repo":"gfx-rs/wgpu","slug":"ray-tracing-pipelines-are-unsupported-on-metal","errorCode":null,"errorMessage":"Ray tracing pipelines are unsupported on Metal","messagePattern":"Ray tracing pipelines are unsupported on Metal","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu-hal/src/metal/device.rs","lineNumber":1964,"sourceCode":"            self.counters.compute_pipelines.add(1);\n\n            Ok(super::ComputePipeline { raw, cs_info })\n        })\n    }\n\n    unsafe fn destroy_compute_pipeline(&self, _pipeline: super::ComputePipeline) {\n        self.counters.compute_pipelines.sub(1);\n    }\n\n    unsafe fn create_ray_tracing_pipeline(\n        &self,\n        _desc: &crate::RayTracingPipelineDescriptor<\n            super::PipelineLayout,\n            super::ShaderModule,\n            super::PipelineCache,\n        >,\n    ) -> Result<super::RayTracingPipeline, crate::PipelineError> {\n        unimplemented!(\"Ray tracing pipelines are unsupported on Metal\")\n    }\n\n    unsafe fn destroy_ray_tracing_pipeline(&self, _pipeline: super::RayTracingPipeline) {\n        unimplemented!(\"Ray tracing pipelines are unsupported on Metal\")\n    }\n\n    unsafe fn get_raytracing_pipeline_group_data(\n        &self,\n        _pipeline: &super::RayTracingPipeline,\n        _groups: core::ops::Range<u32>,\n    ) -> Result<Vec<u8>, crate::DeviceError> {\n        unimplemented!(\"Ray tracing pipelines are unsupported on Metal\")\n    }\n\n    unsafe fn create_pipeline_cache(\n        &self,\n        _desc: &crate::PipelineCacheDescriptor<'_>,\n    ) -> Result<super::PipelineCache, crate::PipelineCacheError> {","sourceCodeStart":1946,"sourceCodeEnd":1982,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-hal/src/metal/device.rs#L1946-L1982","documentation":"`create_ray_tracing_pipeline` on the Metal backend is a stub that panics with `unimplemented!(\"Ray tracing pipelines are unsupported on Metal\")`. The Metal backend simply does not implement hardware ray tracing pipelines, so calling this API always panics instead of returning a Result error.","triggerScenarios":"Calling `Device::create_ray_tracing_pipeline` (wgpu-hal `create_ray_tracing_pipeline`) on the Metal backend with any descriptor.","commonSituations":"Cross-backend code that constructs RT pipelines unconditionally (Vulkan/DX12 primary targets) and is then run on macOS/Metal; RT feature detection not performed before pipeline creation.","solutions":["Do not create ray tracing pipelines on Metal; gate creation behind a backend check (AdapterInfo::backend != Metal)","Use compute-shader ray tracing on Metal instead","If RT is required, choose a backend that supports it (Vulkan with rayTracingPipeline, DX12 with DXR)"],"exampleFix":"// before\nlet rt_pipeline = unsafe { device.create_ray_tracing_pipeline(&rt_desc) }?;\n// after\nif adapter.get_info().backend == Backend::Metal {\n    return Err(anyhow!(\"ray tracing not supported on Metal\"));\n}","handlingStrategy":"fallback","validationCode":"fn rt_supported(info: &AdapterInfo) -> bool { !matches!(info.backend, Backend::Metal) }","typeGuard":null,"tryCatchPattern":"// panic, not Err — must be prevented, not caught:\nif rt_supported(&adapter.get_info()) { pipeline = Some(create_rt_pipeline(..)) } else { pipeline = None; /* compute fallback */ }","preventionTips":["Feature-detect RT via backend check before creating RT pipelines","Provide a compute-shader tracing fallback for Metal/macOS","Never construct RT pipeline descriptors on Metal-verified adapters"],"tags":["rust","metal","ray-tracing","unimplemented"],"backgroundTag":"unimplemented-metal-ray-tracing","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}