{"record":{"id":"aeed7784e6fb449f","repo":"gfx-rs/wgpu","slug":"mesh-shader-feature-must-be-enabled-to-call-multi","errorCode":null,"errorMessage":"MESH_SHADER feature must be enabled to call multi_draw_mesh_tasks_indirect","messagePattern":"MESH_SHADER feature must be enabled to call multi_draw_mesh_tasks_indirect","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":3910,"sourceCode":"        indirect_offset: crate::BufferAddress,\n        count: u32,\n    ) {\n        let buffer = indirect_buffer.as_webgpu();\n\n        for i in 0..count {\n            let offset = indirect_offset + i as crate::BufferAddress * 20;\n            self.inner\n                .draw_indexed_indirect_with_f64(&buffer.inner, offset as f64);\n        }\n    }\n\n    fn multi_draw_mesh_tasks_indirect(\n        &mut self,\n        _indirect_buffer: &dispatch::DispatchBuffer,\n        _indirect_offset: crate::BufferAddress,\n        _count: u32,\n    ) {\n        panic!(\"MESH_SHADER feature must be enabled to call multi_draw_mesh_tasks_indirect\")\n    }\n\n    fn multi_draw_indirect_count(\n        &mut self,\n        _indirect_buffer: &dispatch::DispatchBuffer,\n        _indirect_offset: crate::BufferAddress,\n        _count_buffer: &dispatch::DispatchBuffer,\n        _count_buffer_offset: crate::BufferAddress,\n        _max_count: u32,\n    ) {\n        panic!(\n            \"MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indirect_count\"\n        )\n    }\n\n    fn multi_draw_indexed_indirect_count(\n        &mut self,\n        _indirect_buffer: &dispatch::DispatchBuffer,","sourceCodeStart":3892,"sourceCodeEnd":3928,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L3892-L3928","documentation":"The WebGPU backend cannot perform batched indirect mesh-task draws, so multi_draw_mesh_tasks_indirect panics unconditionally. Like the other mesh-task entry points it requires the MESH_SHADER feature on a native backend.","triggerScenarios":"Calling render_pass.multi_draw_mesh_tasks_indirect(indirect_buffer, indirect_offset, count) on the webgpu backend, or on a backend lacking Features::MESH_SHADER.","commonSituations":"GPU-driven culling systems issuing many mesh-task draws from one buffer, ported to wasm; generic multi-draw dispatch shared across backends; benchmarks exercising all multi-draw variants on every backend.","solutions":["Gate the call behind Features::MESH_SHADER and backend != WebGPU.","Loop individual draw_mesh_tasks_indirect calls only on supporting backends, otherwise use a non-mesh fallback.","Restructure GPU-driven rendering to a compute-generated indirect buffer consumed by draw_indirect on web.","Resolve a rendering-path enum once at device creation and dispatch on it."],"exampleFix":"// before\nrender_pass.multi_draw_mesh_tasks_indirect(&buf, 0, count);\n// after\nif mesh_shader_supported {\n    render_pass.multi_draw_mesh_tasks_indirect(&buf, 0, count);\n} else {\n    for i in 0..count { render_pass.draw_indirect(&buf, i * stride); }\n}","handlingStrategy":"validation","validationCode":"if supports_mesh_shader(device.features(), backend) {\n    render_pass.multi_draw_mesh_tasks_indirect(&buf, 0, count);\n} else { /* fallback */ }","typeGuard":"fn supports_mesh_shader(f: Features, b: Backend) -> bool {\n    f.contains(Features::MESH_SHADER) && b != Backend::Browser\n}","tryCatchPattern":null,"preventionTips":["Select the GPU-driven rendering path based on mesh-shader support.","Use compute + regular indirect draws as the portable alternative.","Avoid assuming all multi-draw variants exist on every backend.","Add capability assertions in debug builds before batched draws."],"tags":["panic","webgpu","mesh-shader","indirect-draw","unsupported-feature"],"backgroundTag":"unsupported-feature-panic","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}