move condition inside Binder::change_pipeline_layout

This commit is contained in:
teoxoy authored and Teodor Tanasoaia committed 2025-12-16 18:06:51 +01:00
1 parent e4cfcf4abd
commit 54e47d7f97
2 files changed
+17 -15

No files matched your search

+14 -4
View File
@@ -7,7 +7,7 @@ use thiserror::Error;
use crate::{
binding_model::{BindGroup, LateMinBufferBindingSizeMismatch, PipelineLayout},
pipeline::LateSizedBufferGroup,
resource::{Labeled, ResourceErrorIdent},
resource::{Labeled, ParentDevice, ResourceErrorIdent},
};
mod compat {
@@ -336,12 +336,20 @@ impl Binder {
}
}
/// Returns `true` if the pipeline layout has been changed, i.e. if the
/// new PL was not the same as the old PL.
pub(super) fn change_pipeline_layout<'a>(
&'a mut self,
new: &Arc<PipelineLayout>,
late_sized_buffer_groups: &[LateSizedBufferGroup],
) {
let old_id_opt = self.pipeline_layout.replace(new.clone());
) -> bool {
if let Some(old) = self.pipeline_layout.as_ref() {
if old.is_equal(new) {
return false;
}
}
let old = self.pipeline_layout.replace(new.clone());
self.manager.update_expectations(&new.bind_group_layouts);
@@ -372,12 +380,14 @@ impl Binder {
}
}
if let Some(old) = old_id_opt {
if let Some(old) = old {
// root constants are the base compatibility property
if old.immediate_size != new.immediate_size {
self.manager.update_start_index(0);
}
}
true
}
pub(super) fn assign_group<'a>(
+3 -11
View File
@@ -202,18 +202,10 @@ pub(super) fn change_pipeline_layout<E, F: FnOnce()>(
where
E: From<DestroyedResourceError>,
{
if state.binder.pipeline_layout.is_none()
|| !state
.binder
.pipeline_layout
.as_ref()
.unwrap()
.is_equal(pipeline_layout)
if state
.binder
.change_pipeline_layout(pipeline_layout, late_sized_buffer_groups)
{
state
.binder
.change_pipeline_layout(pipeline_layout, late_sized_buffer_groups);
f();
super::immediates_clear(