Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion wgpu-types/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,15 @@ pub struct BindGroupLayoutEntry {
/// If the binding is an array of multiple resources. Corresponds to `binding_array<T>` in the shader.
///
/// When this is `Some` the following validation applies:
/// - Size must be of value 1 or greater.
/// - Count must be of value 1 or greater, this corresponds to the length of the array of resources that will be bound.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to Count to match the name of the field and made it explicit that this conveys the length of the array, which helps clarify how PARTIALLY_BOUND_BINDING_ARRAY affects the validation rules.

/// - When `ty == BindingType::Texture`, [`Features::TEXTURE_BINDING_ARRAY`] must be supported.
/// - When `ty == BindingType::Sampler`, [`Features::TEXTURE_BINDING_ARRAY`] must be supported.
/// - When `ty == BindingType::Buffer`, [`Features::BUFFER_BINDING_ARRAY`] must be supported.
/// - When `ty == BindingType::Buffer` and `ty.ty == BufferBindingType::Storage`, [`Features::STORAGE_RESOURCE_BINDING_ARRAY`] must be supported.
/// - When `ty == BindingType::StorageTexture`, [`Features::STORAGE_RESOURCE_BINDING_ARRAY`] must be supported.
/// - When any binding in the group is an array, no `BindingType::Buffer` in the group may have `has_dynamic_offset == true`
/// - When any binding in the group is an array, no `BindingType::Buffer` in the group may have `ty.ty == BufferBindingType::Uniform`.
/// - If [`Features::PARTIALLY_BOUND_BINDING_ARRAY`] is enabled, the specified count becomes the upper bound instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very helpful!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... I hear you, it's a small change and a lot of overhead, but this extra bit of information would've saved me much quite a bit of time trying to understand & use a variable length array :)

///
#[cfg_attr(feature = "serde", serde(default))]
pub count: Option<NonZeroU32>,
Expand Down
Loading