move BGL same device check inside create_bind_group

This commit is contained in:
teoxoy 2024-06-18 20:41:38 +02:00 committed by Nicolas Silva
parent c01a1335aa
commit 14e750205a
2 changed files with 3 additions and 5 deletions

View File

@ -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,

View File

@ -2065,6 +2065,9 @@ impl<A: HalApi> Device<A> {
hub: &Hub<A>,
) -> Result<BindGroup<A>, 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.