Fix passing a stride of 0 for draw_indirect

This commit is contained in:
Pierre Krieger 2017-06-23 15:15:12 +02:00
parent 5d9e298ec3
commit e9e86fcebc
2 changed files with 5 additions and 1 deletions

View File

@ -299,7 +299,8 @@ impl<P> AutoCommandBufferBuilder<P> {
descriptor_sets(&mut self.inner, true, pipeline.clone(), sets); descriptor_sets(&mut self.inner, true, pipeline.clone(), sets);
vertex_buffers(&mut self.inner, &pipeline, vertices); vertex_buffers(&mut self.inner, &pipeline, vertices);
self.inner.draw_indirect(indirect_buffer, draw_count, 0); self.inner.draw_indirect(indirect_buffer, draw_count,
mem::size_of::<DrawIndirectCommand>() as u32);
Ok(self) Ok(self)
} }
} }

View File

@ -627,6 +627,9 @@ impl<P> UnsafeCommandBufferBuilder<P> {
let vk = self.device().pointers(); let vk = self.device().pointers();
let cmd = self.internal_object(); let cmd = self.internal_object();
debug_assert!(draw_count == 0 || ((stride % 4) == 0) &&
stride as usize >= mem::size_of::<vk::DrawIndirectCommand>());
let inner = buffer.inner(); let inner = buffer.inner();
debug_assert!(inner.offset < buffer.size()); debug_assert!(inner.offset < buffer.size());
debug_assert!(inner.buffer.usage_indirect_buffer()); debug_assert!(inner.buffer.usage_indirect_buffer());