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_indirect_count

What it means

multi_draw_indirect_count (batched indirect draws with a GPU-side count) is not implemented by the WebGPU backend, so wgpu panics. The MULTI_DRAW_INDIRECT_COUNT feature must be enabled and a native backend used.

Source

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

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

    fn multi_draw_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_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,

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Request Features::MULTI_DRAW_INDIRECT_COUNT in required_features and verify adapter.features() before use.
  2. Emulate on web with a loop of draw_indirect using a CPU-side count.
  3. Use plain multi_draw_indirect with a CPU-known count when the feature is unavailable.
  4. Pick a rendering strategy at device creation that avoids count-driven indirect draws on unsupported backends.

Example fix

// before
render_pass.multi_draw_indirect_count(&buf, 0, &count_buf, 0, max);
// after
if features.contains(Features::MULTI_DRAW_INDIRECT_COUNT) && !is_webgpu {
    render_pass.multi_draw_indirect_count(&buf, 0, &count_buf, 0, max);
} else {
    render_pass.multi_draw_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_indirect_count(&buf, 0, &cb, 0, max); } else { render_pass.multi_draw_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_indirect_count(indirect_buffer, offset, count_buffer, count_offset, max_count) on the webgpu backend, or on a native backend where Features::MULTI_DRAW_INDIRECT_COUNT was not requested at device creation.

Common situations: GPU-driven rendering with compute-produced draw counts compiled to wasm; device creation omitting the feature from required_features; code assuming the feature exists on all native adapters.

Related errors


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