Add function execute_commands_from_vec to accept multiple command buffers from a vector. (#1175)

* Add function `execute_commands_from_vec` to handle submission of multiple secondarycommand buffers.

* fix typo
This commit is contained in:
WarpspeedSCP 2019-11-26 07:10:43 +00:00 committed by Austin Johnson
parent 72889807e3
commit fb3ef9d43e
2 changed files with 23 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- Added Swapchain::with_old_swapchain() - same as previous Swapchain::new(), if an oldswapchain needs to be used
- Swapchain::new() now doesnt need to have the old_swapchain parameter anymore but requires the ColorSpace
- Fixed code generated by `shader!` macro so that SSBO's are supported again (broken in 0.16.0).
- Add function `execute_commands_from_vec` to handle submission of multiple secondary command buffers.
- Allow `DebugCallback` to be sent between threads
- Decouple descriptor sets from pipeline

View File

@ -1259,6 +1259,28 @@ impl<P> AutoCommandBufferBuilder<P> {
Ok(self)
}
/// Adds a command that executes all the commands in a vector.
///
/// **This function is unsafe for now because safety checks and synchronization are not
/// implemented.**
// TODO: implement correctly
pub unsafe fn execute_commands_from_vec<C>(mut self, command_buffers: Vec<C>)
-> Result<Self, ExecuteCommandsError>
where C: CommandBuffer + Send + Sync + 'static
{
{
let mut builder = self.inner.execute_commands();
for cmd_buffer in command_buffers {
builder.add(cmd_buffer);
}
builder.submit()?;
}
self.state_cacher.invalidate();
Ok(self)
}
/// Adds a command that writes the content of a buffer.
///
/// This function is similar to the `memset` function in C. The `data` parameter is a number