{"record":{"id":"8829ca1a2992b4ae","repo":"gfx-rs/wgpu","slug":"multi-draw-indirect-count-feature-must-be-enabled-8829ca","errorCode":null,"errorMessage":"MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count","messagePattern":"MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":3934,"sourceCode":"        _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,\n        _indirect_offset: crate::BufferAddress,\n        _count_buffer: &dispatch::DispatchBuffer,\n        _count_buffer_offset: crate::BufferAddress,\n        _max_count: u32,\n    ) {\n        panic!(\"MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count\")\n    }\n\n    fn multi_draw_mesh_tasks_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!(\"MESH_SHADER feature must be enabled to call multi_draw_mesh_tasks_indirect_count\")\n    }\n\n    fn insert_debug_marker(&mut self, label: &str) {\n        self.inner.insert_debug_marker(label);\n    }\n\n    fn push_debug_group(&mut self, group_label: &str) {","sourceCodeStart":3916,"sourceCodeEnd":3952,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L3916-L3952","documentation":"multi_draw_indexed_indirect_count is likewise unsupported on the WebGPU backend and wgpu panics unconditionally there; on native backends it requires Features::MULTI_DRAW_INDIRECT_COUNT. The panic prevents an unsupported batched indexed indirect draw from being silently ignored.","triggerScenarios":"Calling render_pass.multi_draw_indexed_indirect_count(indirect_buffer, offset, count_buffer, count_offset, max_count) on the webgpu backend, or on a native device created without Features::MULTI_DRAW_INDIRECT_COUNT.","commonSituations":"Indexed GPU-driven rendering paths ported to the browser; feature lists accidentally dropped from DeviceDescriptor during refactors; hardware where the feature is absent but shared code assumes it.","solutions":["Verify Features::MULTI_DRAW_INDIRECT_COUNT in adapter.features() and request it at device creation.","Guard the call with a backend check and use a fallback loop of indexed indirect draws on web.","Fall back to multi_draw_indexed_indirect with a CPU-side count when unavailable.","Centralize capability checks so all indirect-count call sites share one gating predicate."],"exampleFix":"// before\nrender_pass.multi_draw_indexed_indirect_count(&buf, 0, &count_buf, 0, max);\n// after\nif features.contains(Features::MULTI_DRAW_INDIRECT_COUNT) && !is_webgpu {\n    render_pass.multi_draw_indexed_indirect_count(&buf, 0, &count_buf, 0, max);\n} else {\n    render_pass.multi_draw_indexed_indirect(&buf, 0, cpu_count);\n}","handlingStrategy":"validation","validationCode":"let ok = device.features().contains(Features::MULTI_DRAW_INDIRECT_COUNT) && !is_webgpu_backend;\nif ok { render_pass.multi_draw_indexed_indirect_count(&buf, 0, &cb, 0, max); } else { render_pass.multi_draw_indexed_indirect(&buf, 0, cpu_count); }","typeGuard":"fn supports_multi_draw_indirect_count(f: Features, b: Backend) -> bool {\n    f.contains(Features::MULTI_DRAW_INDIRECT_COUNT) && b != Backend::Browser\n}","tryCatchPattern":null,"preventionTips":["Share one capability predicate across all indirect-count call sites.","Fall back to CPU-count indexed indirect draws when unsupported.","Re-check feature gating after refactors of DeviceDescriptor setup.","Test indexed GPU-driven paths on both native and web backends."],"tags":["panic","webgpu","indirect-draw","feature-flag","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"}