diff --git a/vulkano/src/command_buffer/synced/commands.rs b/vulkano/src/command_buffer/synced/commands.rs index 72fd6e12..8b6d1f28 100644 --- a/vulkano/src/command_buffer/synced/commands.rs +++ b/vulkano/src/command_buffer/synced/commands.rs @@ -3121,18 +3121,24 @@ impl<'b> SyncCommandBufferBuilderBindDescriptorSets<'b> { // be disturbed. let current_layouts = state.pipeline_layout.descriptor_set_layouts(); let new_layouts = pipeline_layout.descriptor_set_layouts(); - (0..first_set + num_descriptor_sets).find(|&num| { + let max = (current_layouts.len() as u32).min(first_set + num_descriptor_sets); + (0..max).find(|&num| { let num = num as usize; !current_layouts[num].is_compatible_with(&new_layouts[num]) }) }; - // Remove disturbed sets and set new pipeline layout. if let Some(invalidate_from) = invalidate_from { + // Remove disturbed sets and set new pipeline layout. state .descriptor_sets .retain(|&num, _| num < invalidate_from); state.pipeline_layout = pipeline_layout; + } else if (first_set + num_descriptor_sets) as usize + >= state.pipeline_layout.descriptor_set_layouts().len() + { + // New layout is a superset of the old one. + state.pipeline_layout = pipeline_layout; } state