Skip to content

Commit 3e0f3b4

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

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

wgpu-core/src/binding_model.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,23 +439,28 @@ impl BindingTypeMaxCountValidator {
439439
/// Bindable resource and the slot to bind it to.
440440
#[derive(Clone, Debug)]
441441
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
442-
pub struct BindGroupEntry<'a> {
442+
pub struct BindGroupEntry<'a, B = BufferId, S = SamplerId, TV = TextureViewId, TLAS = TlasId>
443+
where
444+
[BufferBinding<B>]: ToOwned,
445+
[S]: ToOwned,
446+
[TV]: ToOwned,
447+
<[BufferBinding<B>] as ToOwned>::Owned: std::fmt::Debug,
448+
<[S] as ToOwned>::Owned: std::fmt::Debug,
449+
<[TV] as ToOwned>::Owned: std::fmt::Debug,
450+
{
443451
/// Slot for which binding provides resource. Corresponds to an entry of the same
444452
/// binding index in the [`BindGroupLayoutDescriptor`].
445453
pub binding: u32,
454+
#[cfg_attr(
455+
feature = "serde",
456+
serde(bound(deserialize = "BindingResource<'a, B, S, TV, TLAS>: Deserialize<'de>"))
457+
)]
446458
/// Resource to attach to the binding
447-
pub resource: BindingResource<'a>,
459+
pub resource: BindingResource<'a, B, S, TV, TLAS>,
448460
}
449461

450-
/// Bindable resource and the slot to bind it to.
451-
#[derive(Clone, Debug)]
452-
pub struct ResolvedBindGroupEntry<'a> {
453-
/// Slot for which binding provides resource. Corresponds to an entry of the same
454-
/// binding index in the [`BindGroupLayoutDescriptor`].
455-
pub binding: u32,
456-
/// Resource to attach to the binding
457-
pub resource: ResolvedBindingResource<'a>,
458-
}
462+
pub type ResolvedBindGroupEntry<'a> =
463+
BindGroupEntry<'a, Arc<Buffer>, Arc<Sampler>, Arc<TextureView>, Arc<Tlas>>;
459464

460465
/// Describes a group of bindings and the resources to be bound.
461466
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)