mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-01-14 22:17:58 -05:00
Fix descriptor set offsets binding on pipeline change
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -263,14 +263,14 @@ pub fn compute_pass_set_pipeline<B: GfxBackend>(
|
||||
.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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,14 +601,14 @@ pub fn render_pass_set_pipeline<B: GfxBackend>(
|
||||
.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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user