diff --git a/CHANGELOG.md b/CHANGELOG.md index e2cf8e63d..5b1e409b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,7 @@ Bottom level categories: #### General - Fix limit comparison logic for `max_inter_stage_shader_variables` By @ErichDonGubler in [#9264](https://github.com/gfx-rs/wgpu/pull/9264). +- Fix incorrect checks for dynamic binding bounds when calling an encoder's `set_bind_group` in passes and bundles. By @ErichDonGubler in [#9308](https://github.com/gfx-rs/wgpu/pull/9308). #### naga diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index a49bc73b4..ec7c01e17 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -1236,6 +1236,7 @@ pub struct BindGroup { pub(crate) used: BindGroupStates, pub(crate) used_buffer_ranges: Vec, pub(crate) used_texture_ranges: Vec, + /// INVARIANT: Sorted by binding index order. pub(crate) dynamic_binding_info: Vec, /// Actual binding sizes for buffers that don't have `min_binding_size` /// specified in BGL. Listed in the order of iteration of `BGL.entries`. diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 73043f2e4..41c92d6cb 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3423,6 +3423,9 @@ impl Device { return Err(Error::DuplicateBinding(a.binding)); } } + + dynamic_binding_info.sort_by_key(|i| i.binding_idx); + let hal_desc = hal::BindGroupDescriptor { label: desc.label.to_hal(self.instance_flags), layout: layout.raw(),