From 8d9601246782b3178a3f6d45c5b1994ef30e1896 Mon Sep 17 00:00:00 2001 From: yanchith Date: Fri, 13 Dec 2019 13:51:13 +0100 Subject: [PATCH] Simplify code and add todo --- wgpu-core/src/device.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wgpu-core/src/device.rs b/wgpu-core/src/device.rs index c6446157794..471c1a143ae 100644 --- a/wgpu-core/src/device.rs +++ b/wgpu-core/src/device.rs @@ -1183,11 +1183,14 @@ impl> Global { let bindings = unsafe { slice::from_raw_parts(desc.bindings, desc.bindings_length) }; { + //TODO: figure out if binding order matters let (bind_group_layout_guard, _) = hub.bind_group_layouts.read(&mut token); - for (id, value) in bind_group_layout_guard.iter(device_id.backend()) { - if &value.bindings[..] == bindings { - return id; - } + let bgl = bind_group_layout_guard + .iter(device_id.backend()) + .find(|(_, value)| &value.bindings[..] == bindings); + + if let Some((id, _)) = bgl { + return id; } }