diff --git a/wgpu-native/src/command/bind.rs b/wgpu-native/src/command/bind.rs index 41939dcec..3e2044a50 100644 --- a/wgpu-native/src/command/bind.rs +++ b/wgpu-native/src/command/bind.rs @@ -22,9 +22,9 @@ pub struct BindGroupPair { } #[derive(Debug)] -pub enum LayoutChange { +pub enum LayoutChange<'a> { Unchanged, - Match(BindGroupId), + Match(BindGroupId, &'a [BufferAddress]), Mismatch, } @@ -105,7 +105,8 @@ impl BindGroupEntry { Some(BindGroupPair { layout_id, ref group_id, - }) if layout_id == bind_group_layout_id => LayoutChange::Match(group_id.value), + }) if layout_id == bind_group_layout_id => + LayoutChange::Match(group_id.value, &self.dynamic_offsets), Some(_) | None => LayoutChange::Mismatch, } } else { diff --git a/wgpu-native/src/command/compute.rs b/wgpu-native/src/command/compute.rs index 755783df3..bbc03f89a 100644 --- a/wgpu-native/src/command/compute.rs +++ b/wgpu-native/src/command/compute.rs @@ -263,14 +263,14 @@ pub fn compute_pass_set_pipeline( .zip(&pipeline_layout.bind_group_layout_ids) .enumerate() { - if let LayoutChange::Match(bg_id) = entry.expect_layout(bgl_id) { + if let LayoutChange::Match(bg_id, offsets) = entry.expect_layout(bgl_id) { let desc_set = bind_group_guard[bg_id].raw.raw(); unsafe { pass.raw.bind_compute_descriptor_sets( &pipeline_layout.raw, index, iter::once(desc_set), - &[], + offsets.iter().map(|offset| *offset as u32), ); } } diff --git a/wgpu-native/src/command/render.rs b/wgpu-native/src/command/render.rs index 5ce504d78..38cecd24d 100644 --- a/wgpu-native/src/command/render.rs +++ b/wgpu-native/src/command/render.rs @@ -601,14 +601,14 @@ pub fn render_pass_set_pipeline( .zip(&pipeline_layout.bind_group_layout_ids) .enumerate() { - if let LayoutChange::Match(bg_id) = entry.expect_layout(bgl_id) { + if let LayoutChange::Match(bg_id, offsets) = entry.expect_layout(bgl_id) { let desc_set = bind_group_guard[bg_id].raw.raw(); unsafe { pass.raw.bind_graphics_descriptor_sets( &pipeline_layout.raw, index, iter::once(desc_set), - &[], + offsets.iter().map(|offset| *offset as u32), ); } }