From 5f8ab36938b1cc9a8baef70c71d9199a690ac581 Mon Sep 17 00:00:00 2001 From: Lachlan Sneff Date: Sat, 11 Apr 2020 23:33:31 -0400 Subject: [PATCH 1/2] [rs] Specified expected structure for draw_indirect and draw_indexed_indirect --- wgpu/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 2ae9cacc63..9f9944ac71 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -1505,6 +1505,18 @@ impl<'a> RenderPass<'a> { /// Draws primitives from the active vertex buffer(s) based on the contents of the `indirect_buffer`. /// /// The active vertex buffers can be set with [`RenderPass::set_vertex_buffer`]. + /// + /// The structure expected in `indirect_buffer` is the following: + /// + /// ```rust + /// #[repr(C)] + /// struct DrawIndirect { + /// vertex_count: u32, + /// instance_count: u32, + /// first_vertex: u32, + /// base_instance: u32, + /// } + /// ``` pub fn draw_indirect(&mut self, indirect_buffer: &'a Buffer, indirect_offset: BufferAddress) { unsafe { wgn::wgpu_render_pass_draw_indirect( @@ -1520,6 +1532,19 @@ impl<'a> RenderPass<'a> { /// /// The active index buffer can be set with [`RenderPass::set_index_buffer`], while the active /// vertex buffers can be set with [`RenderPass::set_vertex_buffer`]. + /// + /// The structure expected in `indirect_buffer` is the following: + /// + /// ```rust + /// #[repr(C)] + /// struct DrawIndexedIndirect { + /// vertex_count: u32, + /// instance_count: u32, + /// first_index: u32, + /// base_vertex: u32, + /// base_instance: u32, + /// } + /// ``` pub fn draw_indexed_indirect( &mut self, indirect_buffer: &'a Buffer, From 3d7bc8c528bf96d77a6ee3f2c8cd5016d513c858 Mon Sep 17 00:00:00 2001 From: Lachlan Sneff Date: Sun, 12 Apr 2020 10:56:15 -0400 Subject: [PATCH 2/2] [rs] Fix documentation based on vulkan docs --- wgpu/src/lib.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 9f9944ac71..6578f66a63 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -1511,10 +1511,10 @@ impl<'a> RenderPass<'a> { /// ```rust /// #[repr(C)] /// struct DrawIndirect { - /// vertex_count: u32, - /// instance_count: u32, - /// first_vertex: u32, - /// base_instance: u32, + /// vertex_count: u32, // The number of vertices to draw. + /// instance_count: u32, // The number of instances to draw. + /// base_vertex: u32, // The Index of the first vertex to draw. + /// base_instance: u32, // The instance ID of the first instance to draw. /// } /// ``` pub fn draw_indirect(&mut self, indirect_buffer: &'a Buffer, indirect_offset: BufferAddress) { @@ -1538,11 +1538,11 @@ impl<'a> RenderPass<'a> { /// ```rust /// #[repr(C)] /// struct DrawIndexedIndirect { - /// vertex_count: u32, - /// instance_count: u32, - /// first_index: u32, - /// base_vertex: u32, - /// base_instance: u32, + /// vertex_count: u32, // The number of vertices to draw. + /// instance_count: u32, // The number of instances to draw. + /// base_index: u32, // The base index within the index buffer. + /// vertex_offset: i32, // The value added to the vertex index before indexing into the vertex buffer. + /// base_instance: u32, // The instance ID of the first instance to draw. /// } /// ``` pub fn draw_indexed_indirect(