diff options
Diffstat (limited to 'third_party/rust/wgpu-hal/src/gles/device.rs')
-rw-r--r-- | third_party/rust/wgpu-hal/src/gles/device.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/third_party/rust/wgpu-hal/src/gles/device.rs b/third_party/rust/wgpu-hal/src/gles/device.rs index 2678488cf8..50c07f3ff0 100644 --- a/third_party/rust/wgpu-hal/src/gles/device.rs +++ b/third_party/rust/wgpu-hal/src/gles/device.rs @@ -483,7 +483,9 @@ impl super::Device { } } -impl crate::Device<super::Api> for super::Device { +impl crate::Device for super::Device { + type A = super::Api; + unsafe fn exit(self, queue: super::Queue) { let gl = &self.shared.context.lock(); unsafe { gl.delete_vertex_array(self.main_vao) }; @@ -1123,8 +1125,10 @@ impl crate::Device<super::Api> for super::Device { !0; bg_layout .entries - .last() - .map_or(0, |b| b.binding as usize + 1) + .iter() + .map(|b| b.binding) + .max() + .map_or(0, |idx| idx as usize + 1) ] .into_boxed_slice(); @@ -1177,7 +1181,16 @@ impl crate::Device<super::Api> for super::Device { ) -> Result<super::BindGroup, crate::DeviceError> { let mut contents = Vec::new(); - for (entry, layout) in desc.entries.iter().zip(desc.layout.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"); + (entry, layout) + }); + for (entry, layout) in layout_and_entry_iter { let binding = match layout.ty { wgt::BindingType::Buffer { .. } => { let bb = &desc.buffers[entry.resource_index as usize]; |