{"record":{"id":"b7cdbca1558f125e","repo":"gfx-rs/wgpu","slug":"mesh-shader-feature-must-be-enabled-to-call-draw-m","errorCode":null,"errorMessage":"MESH_SHADER feature must be enabled to call draw_mesh_tasks","messagePattern":"MESH_SHADER feature must be enabled to call draw_mesh_tasks","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":3843,"sourceCode":"                instances.end - instances.start,\n                vertices.start,\n                instances.start,\n            );\n    }\n\n    fn draw_indexed(&mut self, indices: Range<u32>, base_vertex: i32, instances: Range<u32>) {\n        self.inner\n            .draw_indexed_with_instance_count_and_first_index_and_base_vertex_and_first_instance(\n                indices.end - indices.start,\n                instances.end - instances.start,\n                indices.start,\n                base_vertex,\n                instances.start,\n            )\n    }\n\n    fn draw_mesh_tasks(&mut self, _group_count_x: u32, _group_count_y: u32, _group_count_z: u32) {\n        panic!(\"MESH_SHADER feature must be enabled to call draw_mesh_tasks\")\n    }\n\n    fn draw_indirect(\n        &mut self,\n        indirect_buffer: &dispatch::DispatchBuffer,\n        indirect_offset: crate::BufferAddress,\n    ) {\n        let buffer = indirect_buffer.as_webgpu();\n        self.inner\n            .draw_indirect_with_f64(&buffer.inner, indirect_offset as f64);\n    }\n\n    fn draw_indexed_indirect(\n        &mut self,\n        indirect_buffer: &dispatch::DispatchBuffer,\n        indirect_offset: crate::BufferAddress,\n    ) {\n        let buffer = indirect_buffer.as_webgpu();","sourceCodeStart":3825,"sourceCodeEnd":3861,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L3825-L3861","documentation":"Mesh shaders are not part of the WebGPU API, so the WebGPU backend's RenderPassEncoder::draw_mesh_tasks is unimplemented and panics. Mesh-task drawing requires the MESH_SHADER feature on a native backend only.","triggerScenarios":"Calling render_pass.draw_mesh_tasks(x, y, z) on a pass running via the webgpu backend, or on any backend without Features::MESH_SHADER enabled.","commonSituations":"Mesh/task pipeline rendering compiled to wasm; feature gates that checked only the device feature but not the backend; experimental mesh-shader demos ported to the browser.","solutions":["Gate draw_mesh_tasks behind Features::MESH_SHADER AND a non-WebGPU backend check.","Provide a traditional vertex/fragment pipeline fallback for unsupported backends.","Skip mesh-shader-only passes entirely when unsupported.","Check device features at startup and refuse mesh-shader workloads on incompatible adapters."],"exampleFix":"// before\nrender_pass.draw_mesh_tasks(1, 1, 1);\n// after\nif mesh_shader_supported {\n    render_pass.draw_mesh_tasks(1, 1, 1);\n} else {\n    render_pass.draw(0..vertex_count, 0..1);\n}","handlingStrategy":"validation","validationCode":"let mesh_ok = device.features().contains(Features::MESH_SHADER) && !is_webgpu_backend;\nif mesh_ok { render_pass.draw_mesh_tasks(1, 1, 1); } else { render_pass.draw(0..n, 0..1); }","typeGuard":"fn supports_mesh_shader(f: Features, b: Backend) -> bool {\n    f.contains(Features::MESH_SHADER) && b != Backend::Browser\n}","tryCatchPattern":null,"preventionTips":["Always provide a vertex-pipeline fallback for mesh-shader draws.","Check both feature and backend before creating mesh-task pipelines.","Gate experimental features behind explicit per-backend opt-in.","Run wasm CI builds to catch unguarded backend-specific calls."],"tags":["panic","webgpu","mesh-shader","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"}