mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 17:02:32 +00:00
Rename bindings to entries
This commit is contained in:
parent
d3e204127c
commit
e693170aef
@ -200,12 +200,16 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
A::CreateBindGroupLayout { id, label, entries } => {
|
||||
A::CreateBindGroupLayout {
|
||||
id,
|
||||
ref label,
|
||||
ref entries,
|
||||
} => {
|
||||
self.device_create_bind_group_layout::<B>(
|
||||
device,
|
||||
&wgt::BindGroupLayoutDescriptor {
|
||||
label: Some(&label),
|
||||
bindings: &entries,
|
||||
label: Some(label),
|
||||
entries,
|
||||
},
|
||||
id,
|
||||
)
|
||||
@ -267,7 +271,7 @@ impl GlobalExt for wgc::hub::Global<IdentityPassThroughFactory> {
|
||||
&wgc::binding_model::BindGroupDescriptor {
|
||||
label: Some(&label),
|
||||
layout: layout_id,
|
||||
bindings: &entry_vec,
|
||||
entries: &entry_vec,
|
||||
},
|
||||
id,
|
||||
)
|
||||
|
@ -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)]
|
||||
|
@ -1195,7 +1195,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
// Validate the count parameter
|
||||
for binding in desc
|
||||
.bindings
|
||||
.entries
|
||||
.iter()
|
||||
.filter(|binding| binding.count.is_some())
|
||||
{
|
||||
@ -1248,7 +1248,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
}
|
||||
|
||||
let raw_bindings = desc
|
||||
.bindings
|
||||
.entries
|
||||
.iter()
|
||||
.map(|binding| hal::pso::DescriptorSetLayoutBinding {
|
||||
binding: binding.binding,
|
||||
@ -1275,7 +1275,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
};
|
||||
|
||||
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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
|
||||
//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<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
};
|
||||
writes.alloc().init(hal::pso::DescriptorSetWrite {
|
||||
set: desc_set.raw(),
|
||||
binding: b.binding,
|
||||
binding,
|
||||
array_offset: 0, //TODO
|
||||
descriptors,
|
||||
});
|
||||
@ -1813,7 +1813,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
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 {
|
||||
|
@ -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],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user