diff --git a/player/src/main.rs b/player/src/main.rs index 7d8a44e45e..eee31dafb7 100644 --- a/player/src/main.rs +++ b/player/src/main.rs @@ -200,12 +200,16 @@ impl GlobalExt for wgc::hub::Global { .unwrap(); } } - A::CreateBindGroupLayout { id, label, entries } => { + A::CreateBindGroupLayout { + id, + ref label, + ref entries, + } => { self.device_create_bind_group_layout::( device, &wgt::BindGroupLayoutDescriptor { - label: Some(&label), - bindings: &entries, + label: Some(label), + entries, }, id, ) @@ -267,7 +271,7 @@ impl GlobalExt for wgc::hub::Global { &wgc::binding_model::BindGroupDescriptor { label: Some(&label), layout: layout_id, - bindings: &entry_vec, + entries: &entry_vec, }, id, ) diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index ae8f3af69e..5f6cf20e9a 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -282,7 +282,7 @@ pub struct BindGroupEntry<'a> { pub struct BindGroupDescriptor<'a> { pub label: Option<&'a str>, pub layout: BindGroupLayoutId, - pub bindings: &'a [BindGroupEntry<'a>], + pub entries: &'a [BindGroupEntry<'a>], } #[derive(Debug)] diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 7900f28957..dba2fa9ec1 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -1195,7 +1195,7 @@ impl Global { let mut token = Token::root(); let hub = B::hub(self); let mut entry_map = FastHashMap::default(); - for entry in desc.bindings { + for entry in desc.entries { if entry_map.insert(entry.binding, entry.clone()).is_some() { return Err(binding_model::BindGroupLayoutError::ConflictBinding( entry.binding, @@ -1221,7 +1221,7 @@ impl Global { // Validate the count parameter for binding in desc - .bindings + .entries .iter() .filter(|binding| binding.count.is_some()) { @@ -1248,7 +1248,7 @@ impl Global { } let raw_bindings = desc - .bindings + .entries .iter() .map(|binding| hal::pso::DescriptorSetLayoutBinding { binding: binding.binding, @@ -1275,7 +1275,7 @@ impl Global { }; let mut count_validator = binding_model::BindingTypeMaxCountValidator::default(); - desc.bindings + desc.entries .iter() .for_each(|b| count_validator.add_binding(b)); // If a single bind group layout violates limits, the pipeline layout is definitely @@ -1294,7 +1294,7 @@ impl Global { entries: entry_map, desc_counts: raw_bindings.iter().cloned().collect(), dynamic_count: desc - .bindings + .entries .iter() .filter(|b| b.has_dynamic_offset()) .count(), @@ -1309,7 +1309,7 @@ impl Global { Some(ref trace) => trace.lock().add(trace::Action::CreateBindGroupLayout { id, label: desc.label.map_or_else(String::new, str::to_string), - entries: desc.bindings.to_owned(), + entries: desc.entries.to_owned(), }), None => (), }; @@ -1465,9 +1465,9 @@ impl Global { let (bind_group_layout_guard, mut token) = hub.bind_group_layouts.read(&mut token); let bind_group_layout = &bind_group_layout_guard[desc.layout]; - // Check that the number of bindings in the descriptor matches - // the number of bindings in the layout. - let actual = desc.bindings.len(); + // Check that the number of entries in the descriptor matches + // the number of entries in the layout. + let actual = desc.entries.len(); let expected = bind_group_layout.entries.len(); if actual != expected { return Err(BindGroupError::BindingsNumMismatch { expected, actual }); @@ -1515,14 +1515,14 @@ impl Global { //TODO: group writes into contiguous sections let mut writes = Vec::new(); - for b in desc.bindings { - let binding = b.binding; + for entry in desc.entries { + let binding = entry.binding; // Find the corresponding declaration in the layout let decl = bind_group_layout .entries .get(&binding) .ok_or(BindGroupError::MissingBindingDeclaration(binding))?; - let descriptors: SmallVec<[_; 1]> = match b.resource { + let descriptors: SmallVec<[_; 1]> = match entry.resource { Br::Buffer(ref bb) => { let (pub_usage, internal_use, min_size, dynamic) = match decl.ty { wgt::BindingType::UniformBuffer { @@ -1774,7 +1774,7 @@ impl Global { }; writes.alloc().init(hal::pso::DescriptorSetWrite { set: desc_set.raw(), - binding: b.binding, + binding, array_offset: 0, //TODO descriptors, }); @@ -1813,7 +1813,7 @@ impl Global { label: desc.label.map_or_else(String::new, str::to_string), layout_id: desc.layout, entries: desc - .bindings + .entries .iter() .map(|entry| { let res = match entry.resource { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index af61e65f06..5e012dbfbc 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1762,6 +1762,6 @@ pub struct BindGroupLayoutDescriptor<'a> { /// Debug label of the bind group layout. This will show up in graphics debuggers for easy identification. pub label: Option<&'a str>, - /// Array of bindings in this BindGroupLayout - pub bindings: &'a [BindGroupLayoutEntry], + /// Array of entries in this BindGroupLayout + pub entries: &'a [BindGroupLayoutEntry], }