gfx-rs/wgpu · error

Feature `DRAW_INDIRECT_COUNT` not enabled

Error message

Feature `DRAW_INDIRECT_COUNT` not enabled

What it means

Panic raised when the indirect-count draw path is taken on a Vulkan device where the draw_indirect_count extension functions were not loaded. The match on device.extension_fns.draw_indirect_count falls into the None arm, meaning Features::DRAW_INDIRECT_COUNT was not enabled on the device.

Source

Thrown at wgpu-hal/src/vulkan/command.rs:1283

        count_offset: wgt::BufferAddress,
        max_count: u32,
    ) {
        let stride = size_of::<wgt::DrawIndirectArgs>() as u32;
        match self.device.extension_fns.draw_indirect_count {
            Some(ref t) => {
                unsafe {
                    t.cmd_draw_indirect_count(
                        self.active,
                        buffer.raw,
                        offset,
                        count_buffer.raw,
                        count_offset,
                        max_count,
                        stride,
                    )
                };
            }
            None => panic!("Feature `DRAW_INDIRECT_COUNT` not enabled"),
        }
    }
    unsafe fn draw_indexed_indirect_count(
        &mut self,
        buffer: &super::Buffer,
        offset: wgt::BufferAddress,
        count_buffer: &super::Buffer,
        count_offset: wgt::BufferAddress,
        max_count: u32,
    ) {
        let stride = size_of::<wgt::DrawIndexedIndirectArgs>() as u32;
        match self.device.extension_fns.draw_indirect_count {
            Some(ref t) => {
                unsafe {
                    t.cmd_draw_indexed_indirect_count(
                        self.active,
                        buffer.raw,
                        offset,

View on GitHub (pinned to 3e11ff59bf)

Solutions

  1. Enable Features::DRAW_INDIRECT_COUNT when creating the device and verify adapter support via features().contains()
  2. Fall back to a plain draw_indirect call with a known instance count when the feature is unavailable
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at wgpu-hal/src/vulkan/command.rs:1283 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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