From 14e750205adb9ac47d9c707a772f6b1497d5802b Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:41:38 +0200 Subject: [PATCH] move BGL same device check inside `create_bind_group` --- wgpu-core/src/device/global.rs | 5 ----- wgpu-core/src/device/resource.rs | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/wgpu-core/src/device/global.rs b/wgpu-core/src/device/global.rs index 7f0c9db43..aca648a78 100644 --- a/wgpu-core/src/device/global.rs +++ b/wgpu-core/src/device/global.rs @@ -15,7 +15,6 @@ use crate::{ pipeline, present, resource::{ self, BufferAccessError, BufferAccessResult, BufferMapOperation, CreateBufferError, - ParentDevice, }, validation::check_buffer_usage, Label, LabelHelpers as _, @@ -1125,10 +1124,6 @@ impl Global { Err(..) => break 'error binding_model::CreateBindGroupError::InvalidLayout, }; - if let Err(e) = bind_group_layout.same_device(&device) { - break 'error e.into(); - } - let bind_group = match device.create_bind_group(&bind_group_layout, desc, hub) { Ok(bind_group) => bind_group, Err(e) => break 'error e, diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index f7c2b522c..d44d98b96 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -2065,6 +2065,9 @@ impl Device { hub: &Hub, ) -> Result, binding_model::CreateBindGroupError> { use crate::binding_model::{BindingResource as Br, CreateBindGroupError as Error}; + + layout.same_device(self)?; + { // Check that the number of entries in the descriptor matches // the number of entries in the layout.