Optimize submit() for no command buffers

This commit is contained in:
Dzmitry Malyshau 2020-12-16 15:02:05 -05:00
parent 42a8dc5b34
commit b84301110c
2 changed files with 4 additions and 1 deletions

View File

@ -294,6 +294,9 @@ impl GlobalPlay for wgc::hub::Global<IdentityPassThroughFactory> {
self.queue_write_texture::<B>(device, &to, &bin, &layout, &size)
.unwrap();
}
A::Submit(_index, ref commands) if commands.is_empty() => {
self.queue_submit::<B>(device, &[]).unwrap();
}
A::Submit(_index, commands) => {
let (encoder, error) = self.device_create_command_encoder::<B>(
device,

View File

@ -483,7 +483,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let (mut swap_chain_guard, mut token) = hub.swap_chains.write(&mut token);
let (mut command_buffer_guard, mut token) = hub.command_buffers.write(&mut token);
{
if !command_buffer_ids.is_empty() {
let (bind_group_guard, mut token) = hub.bind_groups.read(&mut token);
let (compute_pipe_guard, mut token) = hub.compute_pipelines.read(&mut token);
let (render_pipe_guard, mut token) = hub.render_pipelines.read(&mut token);