{"record":{"id":"2e89d452289899f7","repo":"gfx-rs/wgpu","slug":"vertex-attribute-64bit-feature-must-be-enabled-to","errorCode":null,"errorMessage":"VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double formats","messagePattern":"VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double formats","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":595,"sourceCode":"        VertexFormat::Float32 => vf::Float32,\n        VertexFormat::Float32x2 => vf::Float32x2,\n        VertexFormat::Float32x3 => vf::Float32x3,\n        VertexFormat::Float32x4 => vf::Float32x4,\n        VertexFormat::Uint32 => vf::Uint32,\n        VertexFormat::Uint32x2 => vf::Uint32x2,\n        VertexFormat::Uint32x3 => vf::Uint32x3,\n        VertexFormat::Uint32x4 => vf::Uint32x4,\n        VertexFormat::Sint32 => vf::Sint32,\n        VertexFormat::Sint32x2 => vf::Sint32x2,\n        VertexFormat::Sint32x3 => vf::Sint32x3,\n        VertexFormat::Sint32x4 => vf::Sint32x4,\n        VertexFormat::Unorm10_10_10_2 => vf::Unorm1010102,\n        VertexFormat::Unorm8x4Bgra => vf::Unorm8x4Bgra,\n        VertexFormat::Float64\n        | VertexFormat::Float64x2\n        | VertexFormat::Float64x3\n        | VertexFormat::Float64x4 => {\n            panic!(\"VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double formats\")\n        }\n    }\n}\n\nfn map_vertex_step_mode(mode: wgt::VertexStepMode) -> webgpu_sys::GpuVertexStepMode {\n    use webgpu_sys::GpuVertexStepMode as sm;\n    use wgt::VertexStepMode;\n    match mode {\n        VertexStepMode::Vertex => sm::Vertex,\n        VertexStepMode::Instance => sm::Instance,\n    }\n}\n\nfn map_extent_3d(extent: wgt::Extent3d) -> webgpu_sys::GpuExtent3dDict {\n    let mapped = webgpu_sys::GpuExtent3dDict::new(extent.width);\n    mapped.set_height(extent.height);\n    mapped.set_depth_or_array_layers(extent.depth_or_array_layers);\n    mapped","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L577-L613","documentation":"The WebGPU (browser) backend's map_vertex_format panics when a vertex buffer layout uses a Float64* VertexFormat, since WebGPU has no double-precision vertex attributes. These formats require the VERTEX_ATTRIBUTE_64BIT feature, which the browser backend does not support.","triggerScenarios":"Creating a render pipeline whose vertex attribute shader_location uses VertexFormat::Float64/Float64x2/Float64x3/Float64x4 on a web-backed device.","commonSituations":"Reusing native vertex layouts (f64 positions, simulation data) in a wasm build; scientific/geometry data pipelines ported from Vulkan without converting attributes to f32.","solutions":["Convert the vertex data to f32 formats (Float32, Float32x2, ...) before upload.","Pack doubles into two u32 attributes and reassemble in the shader if precision is required.","Keep the 64-bit path behind a check of Features::VERTEX_ATTRIBUTE_64BIT and provide an f32 fallback layout for web."],"exampleFix":"// before\nattributes: &[wgpu::VertexAttribute { format: wgpu::VertexFormat::Float64x3, offset: 0, shader_location: 0 }]\n// after\nattributes: &[wgpu::VertexAttribute { format: wgpu::VertexFormat::Float32x3, offset: 0, shader_location: 0 }]","handlingStrategy":"validation","validationCode":"let uses_f64 = layout.attributes.iter().any(|a| matches!(a.format,\n    wgpu::VertexFormat::Float64 | wgpu::VertexFormat::Float64x2\n    | wgpu::VertexFormat::Float64x3 | wgpu::VertexFormat::Float64x4));\nif uses_f64 && !device.features().contains(wgpu::Features::VERTEX_ATTRIBUTE_64BIT) {\n    return Err(\"f64 vertex attributes unsupported on this backend; convert to f32\".into());\n}","typeGuard":"fn uses_f64_attributes(layout: &wgpu::VertexBufferLayout) -> bool {\n    layout.attributes.iter().any(|a| matches!(a.format,\n        wgpu::VertexFormat::Float64 | wgpu::VertexFormat::Float64x2\n        | wgpu::VertexFormat::Float64x3 | wgpu::VertexFormat::Float64x4))\n}","tryCatchPattern":null,"preventionTips":["Standardize vertex data on f32 formats unless the 64-bit feature is verified.","Add a build-time or init-time check that rejects f64 attributes on web targets.","When duals are needed, pack as 2x u32 attributes and reconstruct in the shader."],"tags":["panic","rust","webgpu","vertex-format","unsupported-feature"],"backgroundTag":"unsupported-backend-feature","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}