mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
Address review notes
This commit is contained in:
parent
5578222685
commit
220f359535
@ -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
|
||||
|
||||
|
@ -306,7 +306,7 @@ pub trait Queue<A: Api>: 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<A: Api>: Send + Sync {
|
||||
unsafe fn discard_encoding(&mut self);
|
||||
unsafe fn end_encoding(&mut self) -> Result<A::CommandBuffer, DeviceError>;
|
||||
/// 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<I>(&mut self, command_buffers: I)
|
||||
where
|
||||
|
@ -615,9 +615,13 @@ impl crate::CommandEncoder<super::Api> 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::<wgt::DrawIndirectArgs>() as u32,
|
||||
);
|
||||
}
|
||||
unsafe fn draw_indexed_indirect(
|
||||
&mut self,
|
||||
@ -625,9 +629,13 @@ impl crate::CommandEncoder<super::Api> 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::<wgt::DrawIndexedIndirectArgs>() as u32,
|
||||
);
|
||||
}
|
||||
unsafe fn draw_indirect_count(
|
||||
&mut self,
|
||||
@ -637,6 +645,7 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
count_offset: wgt::BufferAddress,
|
||||
max_count: u32,
|
||||
) {
|
||||
let stride = mem::size_of::<wgt::DrawIndirectArgs>() as u32;
|
||||
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<super::Api> for super::CommandEncoder {
|
||||
count_buffer.raw,
|
||||
count_offset,
|
||||
max_count,
|
||||
0,
|
||||
stride,
|
||||
);
|
||||
}
|
||||
Some(super::ExtensionFn::Promoted) => {
|
||||
@ -657,7 +666,7 @@ impl crate::CommandEncoder<super::Api> 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<super::Api> for super::CommandEncoder {
|
||||
count_offset: wgt::BufferAddress,
|
||||
max_count: u32,
|
||||
) {
|
||||
let stride = mem::size_of::<wgt::DrawIndexedIndirectArgs>() as u32;
|
||||
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<super::Api> for super::CommandEncoder {
|
||||
count_buffer.raw,
|
||||
count_offset,
|
||||
max_count,
|
||||
0,
|
||||
stride,
|
||||
);
|
||||
}
|
||||
Some(super::ExtensionFn::Promoted) => {
|
||||
@ -691,7 +701,7 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
count_buffer.raw,
|
||||
count_offset,
|
||||
max_count,
|
||||
0,
|
||||
stride,
|
||||
);
|
||||
}
|
||||
None => panic!("Feature `DRAW_INDIRECT_COUNT` not enabled"),
|
||||
|
Loading…
Reference in New Issue
Block a user