gfx-rs/wgpu · error
not implemented
Error message
not implemented
What it means
`map_vertex_format` in the Metal backend's `conv.rs` panics with `unimplemented!()` for 64-bit float vertex formats (Float64, Float64x2, Float64x3, Float64x4). Metal Shading Language / MTLVertexFormat has no direct double-precision vertex attribute support in the set this backend maps, so the conversion is intentionally unimplemented.
Source
Thrown at wgpu-hal/src/metal/conv.rs:245
Vf::Snorm16x4 => MTL::Short4Normalized,
Vf::Uint16x4 => MTL::UShort4,
Vf::Sint16x4 => MTL::Short4,
Vf::Float16x4 => MTL::Half4,
Vf::Uint32 => MTL::UInt,
Vf::Sint32 => MTL::Int,
Vf::Float32 => MTL::Float,
Vf::Uint32x2 => MTL::UInt2,
Vf::Sint32x2 => MTL::Int2,
Vf::Float32x2 => MTL::Float2,
Vf::Uint32x3 => MTL::UInt3,
Vf::Sint32x3 => MTL::Int3,
Vf::Float32x3 => MTL::Float3,
Vf::Uint32x4 => MTL::UInt4,
Vf::Sint32x4 => MTL::Int4,
Vf::Float32x4 => MTL::Float4,
Vf::Unorm10_10_10_2 => MTL::UInt1010102Normalized,
Vf::Unorm8x4Bgra => MTL::UChar4Normalized_BGRA,
Vf::Float64 | Vf::Float64x2 | Vf::Float64x3 | Vf::Float64x4 => unimplemented!(),
}
}
pub fn map_index_format(format: wgt::IndexFormat) -> (u64, MTLIndexType) {
match format {
wgt::IndexFormat::Uint16 => (2, MTLIndexType::UInt16),
wgt::IndexFormat::Uint32 => (4, MTLIndexType::UInt32),
}
}
pub fn map_step_mode(mode: wgt::VertexStepMode) -> MTLVertexStepFunction {
match mode {
wgt::VertexStepMode::Vertex => MTLVertexStepFunction::PerVertex,
wgt::VertexStepMode::Instance => MTLVertexStepFunction::PerInstance,
}
}
pub fn map_stencil_op(op: wgt::StencilOperation) -> MTLStencilOperation {View on GitHub (pinned to 3e11ff59bf)
Solutions
- Change vertex formats to f32 variants (Float32, Float32x2, Float32x3, Float32x4)
- Convert f64 data to f32 on the CPU when uploading the vertex buffer
- Encode large-precision values as u32/f32 pairs with a custom transform in the vertex shader
Example fix
// before
attributes: &[VertexAttribute { format: VertexFormat::Float64x3, offset: 0, shader_location: 0 }]
// after
attributes: &[VertexAttribute { format: VertexFormat::Float32x3, offset: 0, shader_location: 0 }] Defensive patterns
Strategy: validation
Validate before calling
fn has_f64_vertex_format(layouts: &[VertexBufferLayout]) -> bool {
layouts.iter().flat_map(|l| &l.attributes).any(|a| matches!(a.format,
VertexFormat::Float64 | VertexFormat::Float64x2 | VertexFormat::Float64x3 | VertexFormat::Float64x4))
} Type guard
fn is_f64_format(f: VertexFormat) -> bool {
matches!(f, VertexFormat::Float64 | VertexFormat::Float64x2 | VertexFormat::Float64x3 | VertexFormat::Float64x4)
} Prevention
- Standardize on Float32 vertex formats across all backends
- Convert f64 source data to f32 during buffer upload
- Add a startup assert that no f64 vertex formats are requested
When it happens
Trigger: Creating a vertex buffer layout (or acceleration structure descriptor, via `map_acceleration_structure_descriptor`) whose `VertexFormat` is one of the four f64 formats, on the Metal backend.
Common situations: Porting Vulkan/DX12 desktop code that uses double-precision vertex data (common in CAD/scientific apps) to Metal; WGSL shaders/vertex layouts authored with f64 attributes.
Related errors
- not implemented
- VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double
- not implemented
- Ray tracing pipelines are unsupported on Metal
- {:?} is not enabled for this backend
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/029dbfc4755b2163.
Report an issue: GitHub.