fix(dx12): don't depend on BG{,L} entry order

This isn't guaranteed by `wgpu-core`; we should try to match by binding
slot index instead.
This commit is contained in:
Erich Gubler 2024-03-21 16:09:29 -04:00
parent c2fb18afb8
commit 4fa2fbb5aa
2 changed files with 14 additions and 1 deletions

View File

@ -162,6 +162,10 @@ Bottom level categories:
- Set object labels when the DEBUG flag is set, even if the VALIDATION flag is disabled. By @DJMcNab in [#5345](https://github.com/gfx-rs/wgpu/pull/5345).
#### DX12
- Don't depend on bind group and bind group layout entry order in HAL. This caused incorrect severely incorrect command execution and, in some cases, crashes. By @ErichDonGubler in [#5421](https://github.com/gfx-rs/wgpu/pull/5421).
## v0.19.3 (2024-03-01)
This release includes `wgpu`, `wgpu-core`, and `wgpu-hal`. All other crates are unchanged.

View File

@ -1100,7 +1100,16 @@ impl crate::Device for super::Device {
}
let mut dynamic_buffers = Vec::new();
for (layout, entry) in desc.layout.entries.iter().zip(desc.entries.iter()) {
let layout_and_entry_iter = desc.entries.iter().map(|entry| {
let layout = desc
.layout
.entries
.iter()
.find(|layout_entry| layout_entry.binding == entry.binding)
.expect("internal error: no layout entry found with binding slot");
(layout, entry)
});
for (layout, entry) in layout_and_entry_iter {
match layout.ty {
wgt::BindingType::Buffer {
has_dynamic_offset: true,