mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-29 10:14:29 +00:00
Limit compatibility check for bound descriptor sets to the length of the current layout (#1716)
* Limit compatibility check for bound descriptor sets to the length of the current layout * Set new pipeline layout if it's a superset of the old one * Preferentially use new layout if they are identical
This commit is contained in:
parent
c1da957797
commit
5e4da07685
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user