Skip to content

Commit 4675393

Browse files
sagudevcwfitzgerald
authored andcommitted
Unify ResolvedBindGroupDescriptor into BindGroupDescriptor
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
1 parent 3e0f3b4 commit 4675393

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

wgpu-core/src/binding_model.rs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -465,29 +465,47 @@ pub type ResolvedBindGroupEntry<'a> =
465465
/// Describes a group of bindings and the resources to be bound.
466466
#[derive(Clone, Debug)]
467467
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
468-
pub struct BindGroupDescriptor<'a> {
468+
pub struct BindGroupDescriptor<
469+
'a,
470+
BGL = BindGroupLayoutId,
471+
B = BufferId,
472+
S = SamplerId,
473+
TV = TextureViewId,
474+
TLAS = TlasId,
475+
> where
476+
[BufferBinding<B>]: ToOwned,
477+
[S]: ToOwned,
478+
[TV]: ToOwned,
479+
<[BufferBinding<B>] as ToOwned>::Owned: std::fmt::Debug,
480+
<[S] as ToOwned>::Owned: std::fmt::Debug,
481+
<[TV] as ToOwned>::Owned: std::fmt::Debug,
482+
[BindGroupEntry<'a, B, S, TV, TLAS>]: ToOwned,
483+
<[BindGroupEntry<'a, B, S, TV, TLAS>] as ToOwned>::Owned: std::fmt::Debug,
484+
{
469485
/// Debug label of the bind group.
470486
///
471487
/// This will show up in graphics debuggers for easy identification.
472488
pub label: Label<'a>,
473489
/// The [`BindGroupLayout`] that corresponds to this bind group.
474-
pub layout: BindGroupLayoutId,
490+
pub layout: BGL,
491+
#[cfg_attr(
492+
feature = "serde",
493+
serde(bound(
494+
deserialize = "<[BindGroupEntry<'a, B, S, TV, TLAS>] as ToOwned>::Owned: Deserialize<'de>"
495+
))
496+
)]
475497
/// The resources to bind to this bind group.
476-
pub entries: Cow<'a, [BindGroupEntry<'a>]>,
498+
pub entries: Cow<'a, [BindGroupEntry<'a, B, S, TV, TLAS>]>,
477499
}
478500

479-
/// Describes a group of bindings and the resources to be bound.
480-
#[derive(Clone, Debug)]
481-
pub struct ResolvedBindGroupDescriptor<'a> {
482-
/// Debug label of the bind group.
483-
///
484-
/// This will show up in graphics debuggers for easy identification.
485-
pub label: Label<'a>,
486-
/// The [`BindGroupLayout`] that corresponds to this bind group.
487-
pub layout: Arc<BindGroupLayout>,
488-
/// The resources to bind to this bind group.
489-
pub entries: Cow<'a, [ResolvedBindGroupEntry<'a>]>,
490-
}
501+
pub type ResolvedBindGroupDescriptor<'a> = BindGroupDescriptor<
502+
'a,
503+
Arc<BindGroupLayout>,
504+
Arc<Buffer>,
505+
Arc<Sampler>,
506+
Arc<TextureView>,
507+
Arc<Tlas>,
508+
>;
491509

492510
/// Describes a [`BindGroupLayout`].
493511
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)