gfx-rs/wgpu · error

not implemented

Error message

not implemented

What it means

`convert_vertex_format_to_naga` in the Metal backend panics with `unimplemented!()` for the 64-bit float vertex formats (Float64..Float64x4) when translating a vertex format for naga/MSL shader input. Metal does not support double-precision vertex attributes, so the conversion is deliberately unimplemented.

Source

Thrown at wgpu-hal/src/metal/device.rs:156

        wgt::VertexFormat::Float32x2 => nt::VertexFormat::Float32x2,
        wgt::VertexFormat::Float32x3 => nt::VertexFormat::Float32x3,
        wgt::VertexFormat::Float32x4 => nt::VertexFormat::Float32x4,
        wgt::VertexFormat::Uint32 => nt::VertexFormat::Uint32,
        wgt::VertexFormat::Uint32x2 => nt::VertexFormat::Uint32x2,
        wgt::VertexFormat::Uint32x3 => nt::VertexFormat::Uint32x3,
        wgt::VertexFormat::Uint32x4 => nt::VertexFormat::Uint32x4,
        wgt::VertexFormat::Sint32 => nt::VertexFormat::Sint32,
        wgt::VertexFormat::Sint32x2 => nt::VertexFormat::Sint32x2,
        wgt::VertexFormat::Sint32x3 => nt::VertexFormat::Sint32x3,
        wgt::VertexFormat::Sint32x4 => nt::VertexFormat::Sint32x4,
        wgt::VertexFormat::Unorm10_10_10_2 => nt::VertexFormat::Unorm10_10_10_2,
        wgt::VertexFormat::Unorm8x4Bgra => nt::VertexFormat::Unorm8x4Bgra,

        wgt::VertexFormat::Float64
        | wgt::VertexFormat::Float64x2
        | wgt::VertexFormat::Float64x3
        | wgt::VertexFormat::Float64x4 => {
            unimplemented!()
        }
    }
}

impl super::Device {
    fn load_shader(
        &self,
        stage: &crate::ProgrammableStage<super::ShaderModule>,
        vertex_buffer_mappings: &[naga::back::msl::VertexBufferMapping],
        layout: &super::PipelineLayout,
        primitive_class: MTLPrimitiveTopologyClass,
        naga_stage: naga::ShaderStage,
    ) -> Result<CompiledShader, crate::PipelineError> {
        match stage.module.source {
            ShaderModuleSource::Naga(ref naga_shader) => {
                let stage_bit = map_naga_stage(naga_stage);
                let (module, module_info) = naga::back::pipeline_constants::process_overrides(
                    &naga_shader.module,

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Use f32 vertex formats (Float32xN) and convert data at upload time
  2. Reformat the vertex buffer to store u32 pairs for high-precision values and reconstruct in the shader
  3. Validate layouts before creating render pipelines to reject f64 formats on Metal

Example fix

// before
{ format: VertexFormat::Float64x2, offset: 0, shader_location: 1 }
// after
{ format: VertexFormat::Float32x2, offset: 0, shader_location: 1 }
Defensive patterns

Strategy: validation

Validate before calling

if has_f64_vertex_format(&vertex_state.buffers) { reject pipeline creation on Metal before calling create_render_pipeline }

Type guard

fn is_f64_format(f: VertexFormat) -> bool {
    matches!(f, VertexFormat::Float64 | VertexFormat::Float64x2 | VertexFormat::Float64x3 | VertexFormat::Float64x4)
}

Prevention

When it happens

Trigger: Creating a render pipeline on Metal whose vertex buffer layout includes VertexFormat::Float64, Float64x2, Float64x3, or Float64x4; `convert_vertex_format_to_naga` is invoked while building the MSL attribute mapping.

Common situations: Vertex buffers shared with desktop GL/Vulkan code using GL_DOUBLE attributes; scientific/precision-sensitive geometry data on Metal.

Related errors


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/8908dcd027ed66af. Report an issue: GitHub.