-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
When calling RenderPass::multi_draw_indirect (or the indexed equivalent) with the count parameter set to 0, wgpu internally changes the draw count to 1.
Repro steps
See this sample gist: https://gist.github.com/davidhi7/47b35e393d83c0062f280737f765befb
This is effectively just the "hello-triangle" example changed to use indirect draw calls.
Expected vs observed behavior
If the count parameter is set to 0, then zero, and not one, draw calls should be dispatched.
Extra materials
I think the bug emerges here:
wgpu/wgpu-core/src/command/render.rs
Lines 3151 to 3156 in 959c2db
| base.commands.push(ArcRenderCommand::MultiDrawIndirect { | |
| buffer: self.resolve_render_pass_buffer_id(scope, buffer_id)?, | |
| offset, | |
| count: NonZeroU32::new(count), | |
| indexed: false, | |
| }); |
If
count is 0, the command count field is set to None. Later, count: None is interpreted as a single indirect draw call:wgpu/wgpu-core/src/command/render_command.rs
Lines 85 to 91 in 959c2db
| MultiDrawIndirect { | |
| buffer_id: id::BufferId, | |
| offset: BufferAddress, | |
| /// Count of `None` represents a non-multi call. | |
| count: Option<NonZeroU32>, | |
| indexed: bool, | |
| }, |
Platform
wgpu v23.0.1
Intel UHD Graphics 620
On Arch Linux running Vulkan
Metadata
Metadata
Assignees
Labels
Type
Projects
Status