gfx-rs/wgpu · error

MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call mu

Error message

MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count

What it means

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.

Source

Thrown at wgpu/src/backend/webgpu.rs:3934

        _indirect_offset: crate::BufferAddress,
        _count_buffer: &dispatch::DispatchBuffer,
        _count_buffer_offset: crate::BufferAddress,
        _max_count: u32,
    ) {
        panic!(
            "MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indirect_count"
        )
    }

    fn multi_draw_indexed_indirect_count(
        &mut self,
        _indirect_buffer: &dispatch::DispatchBuffer,
        _indirect_offset: crate::BufferAddress,
        _count_buffer: &dispatch::DispatchBuffer,
        _count_buffer_offset: crate::BufferAddress,
        _max_count: u32,
    ) {
        panic!("MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count")
    }

    fn multi_draw_mesh_tasks_indirect_count(
        &mut self,
        _indirect_buffer: &dispatch::DispatchBuffer,
        _indirect_offset: crate::BufferAddress,
        _count_buffer: &dispatch::DispatchBuffer,
        _count_buffer_offset: crate::BufferAddress,
        _max_count: u32,
    ) {
        panic!("MESH_SHADER feature must be enabled to call multi_draw_mesh_tasks_indirect_count")
    }

    fn insert_debug_marker(&mut self, label: &str) {
        self.inner.insert_debug_marker(label);
    }

    fn push_debug_group(&mut self, group_label: &str) {

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Verify Features::MULTI_DRAW_INDIRECT_COUNT in adapter.features() and request it at device creation.
  2. Guard the call with a backend check and use a fallback loop of indexed indirect draws on web.
  3. Fall back to multi_draw_indexed_indirect with a CPU-side count when unavailable.
  4. Centralize capability checks so all indirect-count call sites share one gating predicate.

Example fix

// before
render_pass.multi_draw_indexed_indirect_count(&buf, 0, &count_buf, 0, max);
// after
if features.contains(Features::MULTI_DRAW_INDIRECT_COUNT) && !is_webgpu {
    render_pass.multi_draw_indexed_indirect_count(&buf, 0, &count_buf, 0, max);
} else {
    render_pass.multi_draw_indexed_indirect(&buf, 0, cpu_count);
}
Defensive patterns

Strategy: validation

Validate before calling

let ok = device.features().contains(Features::MULTI_DRAW_INDIRECT_COUNT) && !is_webgpu_backend;
if ok { render_pass.multi_draw_indexed_indirect_count(&buf, 0, &cb, 0, max); } else { render_pass.multi_draw_indexed_indirect(&buf, 0, cpu_count); }

Type guard

fn supports_multi_draw_indirect_count(f: Features, b: Backend) -> bool {
    f.contains(Features::MULTI_DRAW_INDIRECT_COUNT) && b != Backend::Browser
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03). Data as JSON: /api/errors/8829ca1a2992b4ae. Report an issue: GitHub.