Skip to content

Commit

Permalink
Unify ResolvedBindGroupDescriptor into BindGroupDescriptor
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev authored and cwfitzgerald committed Feb 7, 2025
1 parent 3e0f3b4 commit 4675393
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,29 +465,47 @@ pub type ResolvedBindGroupEntry<'a> =
/// Describes a group of bindings and the resources to be bound.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct BindGroupDescriptor<'a> {
pub struct BindGroupDescriptor<
'a,
BGL = BindGroupLayoutId,
B = BufferId,
S = SamplerId,
TV = TextureViewId,
TLAS = TlasId,
> where
[BufferBinding<B>]: ToOwned,
[S]: ToOwned,
[TV]: ToOwned,
<[BufferBinding<B>] as ToOwned>::Owned: std::fmt::Debug,
<[S] as ToOwned>::Owned: std::fmt::Debug,
<[TV] as ToOwned>::Owned: std::fmt::Debug,
[BindGroupEntry<'a, B, S, TV, TLAS>]: ToOwned,
<[BindGroupEntry<'a, B, S, TV, TLAS>] as ToOwned>::Owned: std::fmt::Debug,
{
/// Debug label of the bind group.
///
/// This will show up in graphics debuggers for easy identification.
pub label: Label<'a>,
/// The [`BindGroupLayout`] that corresponds to this bind group.
pub layout: BindGroupLayoutId,
pub layout: BGL,
#[cfg_attr(
feature = "serde",
serde(bound(
deserialize = "<[BindGroupEntry<'a, B, S, TV, TLAS>] as ToOwned>::Owned: Deserialize<'de>"
))
)]
/// The resources to bind to this bind group.
pub entries: Cow<'a, [BindGroupEntry<'a>]>,
pub entries: Cow<'a, [BindGroupEntry<'a, B, S, TV, TLAS>]>,
}

/// Describes a group of bindings and the resources to be bound.
#[derive(Clone, Debug)]
pub struct ResolvedBindGroupDescriptor<'a> {
/// Debug label of the bind group.
///
/// This will show up in graphics debuggers for easy identification.
pub label: Label<'a>,
/// The [`BindGroupLayout`] that corresponds to this bind group.
pub layout: Arc<BindGroupLayout>,
/// The resources to bind to this bind group.
pub entries: Cow<'a, [ResolvedBindGroupEntry<'a>]>,
}
pub type ResolvedBindGroupDescriptor<'a> = BindGroupDescriptor<
'a,
Arc<BindGroupLayout>,
Arc<Buffer>,
Arc<Sampler>,
Arc<TextureView>,
Arc<Tlas>,
>;

/// Describes a [`BindGroupLayout`].
#[derive(Clone, Debug)]
Expand Down

0 comments on commit 4675393

Please sign in to comment.