Skip to content

Debug assertion fail on DX12 due to miscalculated indirect draw arg stride #7955

@Noxime

Description

@Noxime

In (at least) [edit] multi_draw_indirect the stride is calculated wrong for Dx12 backend.

debug_assert_eq!(
draw_data.offset,
current_draw_data.offset + stride * current_draw_data.count as u64
);

The draw_data.offset is calculated to be 28 in DrawBatcher::add, due to "space for D3D12 special constants". I am not familiar with DX12 backend enough to know what these are, but it seems right. However, the right hand of this assert is calculated by

pub(crate) const fn get_stride_of_indirect_args(indexed: bool) -> u64 {
match indexed {
false => size_of::<wgt::DrawIndirectArgs>() as u64,
true => size_of::<wgt::DrawIndexedIndirectArgs>() as u64,
}
}

which does not account for those extra constants and returns 16 bytes.

wgpu 26.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions