gfx-rs/wgpu · error
not implemented
Error message
not implemented
What it means
This is a Rust `unimplemented!()` panic in wgpu-hal's Metal backend inside `update_bind_group_state`. The backend explicitly does not handle ray-tracing shader stages (RayGeneration, AnyHit, ClosestHit, Miss) when mapping bind group resources per stage; Metal has no hardware ray tracing pipeline support in this backend, so these stages are hard-stubbed. Hitting it means a bind group was bound with a pipeline layout that included ray-tracing stage visibility.
Source
Thrown at wgpu-hal/src/metal/command.rs:327
/// Updates the bindings for a single shader stage, called in `set_bind_group`.
fn update_bind_group_state(
&mut self,
encoder: Encoder<'_>,
index_base: super::ResourceData<u32>,
bg_info: &super::BindGroupLayoutInfo,
dynamic_offsets: &[wgt::DynamicOffset],
group_index: u32,
group: &super::BindGroup,
) {
use naga::ShaderStage as S;
let resource_indices = match encoder.stage() {
S::Vertex => &bg_info.base_resource_indices.vs,
S::Fragment => &bg_info.base_resource_indices.fs,
S::Task => &bg_info.base_resource_indices.ts,
S::Mesh => &bg_info.base_resource_indices.ms,
S::Compute => &bg_info.base_resource_indices.cs,
S::RayGeneration | S::AnyHit | S::ClosestHit | S::Miss => unimplemented!(),
};
let buffers = match encoder.stage() {
S::Vertex => group.counters.vs.buffers,
S::Fragment => group.counters.fs.buffers,
S::Task => group.counters.ts.buffers,
S::Mesh => group.counters.ms.buffers,
S::Compute => group.counters.cs.buffers,
S::RayGeneration | S::AnyHit | S::ClosestHit | S::Miss => unimplemented!(),
};
let mut changes_sizes_buffer = false;
for index in 0..buffers {
let res = &group.buffers[(index_base.buffers + index) as usize];
match res {
super::BufferLikeResource::Buffer {
ptr,
mut offset,
dynamic_index,
binding_size,View on GitHub (pinned to 3e11ff59bf)
Solutions
- Remove ray-tracing shader stages from all binding visibilities in the PipelineLayout used on Metal
- Keep ray-tracing pipeline layouts behind a cfg/backend check and only construct them on backends that support ray tracing (Vulkan/DX12)
- File or check an upstream issue for Metal ray tracing support; until then treat Metal as a non-ray-tracing backend
Example fix
// before
let layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
bind_group_layouts: &[&bgl_with_rt_visibility],
..
});
// after
let bgl_desc.visibility = ShaderStages::VERTEX | ShaderStages::FRAGMENT; // drop RT stages on Metal Defensive patterns
Strategy: validation
Validate before calling
fn layout_is_metal_safe(layout: &PipelineLayoutDescriptor) -> bool {
const RT: ShaderStages = ShaderStages::RAY_GENERATION | ShaderStages::ANY_HIT | ShaderStages::CLOSEST_HIT | ShaderStages::MISS;
layout.bind_group_layouts.iter().flatten().all(|b| !b.visible_stages().intersects(RT))
} Type guard
fn uses_rt_stages(v: wgt::ShaderStages) -> bool {
v.intersects(wgt::ShaderStages::RAY_GENERATION | wgt::ShaderStages::ANY_HIT | wgt::ShaderStages::CLOSEST_HIT | wgt::ShaderStages::MISS)
} Prevention
- Check AdapterInfo::backend before enabling any ray-tracing feature on macOS
- Keep RT-visible bindings in layouts only constructed for Vulkan/DX12
- Run cross-backend test suites against Metal early in CI
When it happens
Trigger: Calling `CommandEncoder::set_bind_group` (or render/compute pass bind group binding) on a Metal device while the pipeline layout has bindings whose `visibility` includes ShaderStages::RAY_GENERATION, ANY_HIT, CLOSEST_HIT, or MISS; the stage match arm falls through to `unimplemented!()` at wgpu-hal/src/metal/command.rs:327.
Common situations: Porting code written for the Vulkan or DX12 backends (where ray tracing is partially supported) to Metal; sharing a pipeline layout across backends; accidentally requesting ray-tracing visibility flags on bindings used in a Metal app.
Related errors
- Ray tracing pipelines are unsupported on Metal
- metal does not support vertex ray hit return
- not implemented
- not implemented
- ray tracing pipelines not yet implemented
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/67f882ea463d42b0.
Report an issue: GitHub.