diff --git a/wgpu-hal/README.md b/wgpu-hal/README.md index cd90852b4b6..0ab7a0283a8 100644 --- a/wgpu-hal/README.md +++ b/wgpu-hal/README.md @@ -3,7 +3,7 @@ It's a spiritual successor to [gfx-hal](https://github.com/gfx-rs/gfx), but with reduced scope, and oriented towards WebGPU implementation goals. It has no overhead for validation or tracking, and the API translation overhead is kept to the bare minimum by the design of WebGPU. -This API can be used for resource-demaninging applications and engines. +This API can be used for resource-demanding applications and engines. # Usage notes diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index af530229e0e..97e3c7c431c 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -306,7 +306,7 @@ pub trait Queue: Send + Sync { ) -> Result<(), SurfaceError>; } -/// Encoder for commands in a command buffers. +/// Encoder for commands in command buffers. /// Serves as a parent for all the encoded command buffers. /// Works in bursts of action: one or more command buffers are recorded, /// then submitted to a queue, and then it needs to be `reset_all()`. @@ -317,7 +317,7 @@ pub trait CommandEncoder: Send + Sync { unsafe fn discard_encoding(&mut self); unsafe fn end_encoding(&mut self) -> Result; /// Reclaims all resources that are allocated for this encoder. - /// Must be passed back all of the command buffers, + /// Must get all of the produced command buffers back, /// and they must not be used by GPU at this moment. unsafe fn reset_all(&mut self, command_buffers: I) where diff --git a/wgpu-hal/src/vulkan/command.rs b/wgpu-hal/src/vulkan/command.rs index a0991600d34..c3186fd40de 100644 --- a/wgpu-hal/src/vulkan/command.rs +++ b/wgpu-hal/src/vulkan/command.rs @@ -615,9 +615,13 @@ impl crate::CommandEncoder for super::CommandEncoder { offset: wgt::BufferAddress, draw_count: u32, ) { - self.device - .raw - .cmd_draw_indirect(self.active, buffer.raw, offset, draw_count, 0); + self.device.raw.cmd_draw_indirect( + self.active, + buffer.raw, + offset, + draw_count, + mem::size_of::() as u64, + ); } unsafe fn draw_indexed_indirect( &mut self, @@ -625,9 +629,13 @@ impl crate::CommandEncoder for super::CommandEncoder { offset: wgt::BufferAddress, draw_count: u32, ) { - self.device - .raw - .cmd_draw_indexed_indirect(self.active, buffer.raw, offset, draw_count, 0); + self.device.raw.cmd_draw_indexed_indirect( + self.active, + buffer.raw, + offset, + draw_count, + mem::size_of::() as u64, + ); } unsafe fn draw_indirect_count( &mut self, @@ -637,6 +645,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_offset: wgt::BufferAddress, max_count: u32, ) { + let stride = mem::size_of::() as u64; match self.device.extension_fns.draw_indirect_count { Some(super::ExtensionFn::Extension(ref t)) => { t.cmd_draw_indirect_count( @@ -646,7 +655,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_buffer.raw, count_offset, max_count, - 0, + stride, ); } Some(super::ExtensionFn::Promoted) => { @@ -657,7 +666,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_buffer.raw, count_offset, max_count, - 0, + stride, ); } None => panic!("Feature `DRAW_INDIRECT_COUNT` not enabled"), @@ -671,6 +680,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_offset: wgt::BufferAddress, max_count: u32, ) { + let stride = mem::size_of::() as u64; match self.device.extension_fns.draw_indirect_count { Some(super::ExtensionFn::Extension(ref t)) => { t.cmd_draw_indexed_indirect_count( @@ -680,7 +690,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_buffer.raw, count_offset, max_count, - 0, + stride, ); } Some(super::ExtensionFn::Promoted) => { @@ -691,7 +701,7 @@ impl crate::CommandEncoder for super::CommandEncoder { count_buffer.raw, count_offset, max_count, - 0, + stride, ); } None => panic!("Feature `DRAW_INDIRECT_COUNT` not enabled"),