gfx-rs/wgpu · error

not implemented

Error message

not implemented

What it means

The DX12 backend's map_vertex_format does not map 64-bit float vertex formats (Float64, Float64x2, Float64x3, Float64x4) to DXGI formats, because DX12 input-assembly has no native double-typed vertex elements. Encountering such a vertex attribute format panics with unimplemented!().

Source

Thrown at wgpu-hal/src/auxil/dxgi/conv.rs:288

        Vf::Snorm16x4 => DXGI_FORMAT_R16G16B16A16_SNORM,
        Vf::Uint16x4 => DXGI_FORMAT_R16G16B16A16_UINT,
        Vf::Sint16x4 => DXGI_FORMAT_R16G16B16A16_SINT,
        Vf::Float16x4 => DXGI_FORMAT_R16G16B16A16_FLOAT,
        Vf::Uint32 => DXGI_FORMAT_R32_UINT,
        Vf::Sint32 => DXGI_FORMAT_R32_SINT,
        Vf::Float32 => DXGI_FORMAT_R32_FLOAT,
        Vf::Uint32x2 => DXGI_FORMAT_R32G32_UINT,
        Vf::Sint32x2 => DXGI_FORMAT_R32G32_SINT,
        Vf::Float32x2 => DXGI_FORMAT_R32G32_FLOAT,
        Vf::Uint32x3 => DXGI_FORMAT_R32G32B32_UINT,
        Vf::Sint32x3 => DXGI_FORMAT_R32G32B32_SINT,
        Vf::Float32x3 => DXGI_FORMAT_R32G32B32_FLOAT,
        Vf::Uint32x4 => DXGI_FORMAT_R32G32B32A32_UINT,
        Vf::Sint32x4 => DXGI_FORMAT_R32G32B32A32_SINT,
        Vf::Float32x4 => DXGI_FORMAT_R32G32B32A32_FLOAT,
        Vf::Unorm10_10_10_2 => DXGI_FORMAT_R10G10B10A2_UNORM,
        Vf::Unorm8x4Bgra => DXGI_FORMAT_B8G8R8A8_UNORM,
        Vf::Float64 | Vf::Float64x2 | Vf::Float64x3 | Vf::Float64x4 => unimplemented!(),
    }
}

pub fn map_acomposite_alpha_mode(mode: wgt::CompositeAlphaMode) -> Dxgi::Common::DXGI_ALPHA_MODE {
    match mode {
        wgt::CompositeAlphaMode::PreMultiplied => Dxgi::Common::DXGI_ALPHA_MODE_PREMULTIPLIED,
        wgt::CompositeAlphaMode::PostMultiplied => Dxgi::Common::DXGI_ALPHA_MODE_STRAIGHT,
        wgt::CompositeAlphaMode::Opaque => Dxgi::Common::DXGI_ALPHA_MODE_IGNORE,
        wgt::CompositeAlphaMode::Auto | wgt::CompositeAlphaMode::Inherit => {
            Dxgi::Common::DXGI_ALPHA_MODE_UNSPECIFIED
        }
    }
}

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Convert double data to f32 on the CPU (or in a compute pass) and use Float32/Float32x2/x3/x4 vertex formats
  2. Pack doubles into two f32 attributes if extra precision is truly needed, and recombine in the shader
  3. Validate the vertex layout before creating the pipeline: reject formats containing Float64 on DX12
  4. File/track an upstream issue if DX12 gains double vertex attribute support

Example fix

// before
attributes: [wgpu::VertexAttribute { format: wgpu::VertexFormat::Float64x3, offset: 0, shader_location: 0 }]
// after
attributes: [wgpu::VertexAttribute { format: wgpu::VertexFormat::Float32x3, offset: 0, shader_location: 0 }]
// (convert positions to f32 when uploading the buffer)
Defensive patterns

Strategy: validation

Validate before calling

fn has_f64_vertex_attribute(layout: &wgpu::VertexBufferLayout) -> bool {
    layout.attributes.iter().any(|a| matches!(a.format,
        wgpu::VertexFormat::Float64 | wgpu::VertexFormat::Float64x2 | wgpu::VertexFormat::Float64x3 | wgpu::VertexFormat::Float64x4))
}

Type guard

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

Try / catch

// this is a hard panic in HAL, not a Result; pre-validate the layout:
assert!(!has_f64_vertex_attribute(&layout), "Float64 vertex formats unsupported on dx12");

Prevention

When it happens

Trigger: Creating a buffer layout (VertexBufferLayout) whose attributes use VertexFormat::Float64, Float64x2, Float64x3, or Float64x4 on the DX12 backend (or any backend routed through this conv code).

Common situations: Importing mesh data authored in doubles (CAD/scientific data) and using it directly as vertex attributes; porting Vulkan/GL code that allowed DOUBLE attribs.

Related errors


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