pub trait MewBindGroup {
type BufferSet;
type BufferArray<T>;
// Required methods
fn new(bind_group: BindGroup, buffers: Self::BufferSet) -> Self;
fn layout_entries() -> &'static Self::BufferArray<BindGroupLayoutEntry>;
fn layout_desc() -> BindGroupLayoutDescriptor<'static>;
fn bind_group_entries(
buffers: &Self::BufferSet,
) -> Self::BufferArray<BindGroupEntry<'_>>;
fn bind_group_desc<'a>(
layout: &'a MewBindGroupLayout<Self>,
entries: &'a Self::BufferArray<BindGroupEntry<'_>>,
) -> BindGroupDescriptor<'a>;
}Expand description
Trait for internal use to work with bind groups - getting their layouts and descriptors and whatnot.
The number of internal buffers must be defined in the generic parameter,
because associated consts are “uNsTAbLe”, apparently.
Required Associated Types§
Sourcetype BufferArray<T>
type BufferArray<T>
A generic array the length of the number of buffers (literally [T; N]).
Required Methods§
Sourcefn new(bind_group: BindGroup, buffers: Self::BufferSet) -> Self
fn new(bind_group: BindGroup, buffers: Self::BufferSet) -> Self
Build this bind group type from a
wgpu::BindGroup
and all its internal buffers in a tuple.
Technically the buffers don’t need to be stored with the bind group they’re used in - or at all, it should even be safe to drop them as they’ll be kept around on the GPU side - but as an abstraction, they exist as members of the bind group.
Sourcefn layout_entries() -> &'static Self::BufferArray<BindGroupLayoutEntry>
fn layout_entries() -> &'static Self::BufferArray<BindGroupLayoutEntry>
Get an array of
wgpu::BindGroupLayoutEntrys
for all internal buffers.
Sourcefn layout_desc() -> BindGroupLayoutDescriptor<'static>
fn layout_desc() -> BindGroupLayoutDescriptor<'static>
Get a
wgpu::BindGroupLayoutDescriptor
to build this type of bind group.
Sourcefn bind_group_entries(
buffers: &Self::BufferSet,
) -> Self::BufferArray<BindGroupEntry<'_>>
fn bind_group_entries( buffers: &Self::BufferSet, ) -> Self::BufferArray<BindGroupEntry<'_>>
Get an array of
wgpu::BindGroupEntrys,
for use with Self::bind_group_desc.
Necessary to put this in a separate function to keep the borrow checker happy - wgpu needs a reference to owned entries, which we can’t return in a struct later.
Sourcefn bind_group_desc<'a>(
layout: &'a MewBindGroupLayout<Self>,
entries: &'a Self::BufferArray<BindGroupEntry<'_>>,
) -> BindGroupDescriptor<'a>
fn bind_group_desc<'a>( layout: &'a MewBindGroupLayout<Self>, entries: &'a Self::BufferArray<BindGroupEntry<'_>>, ) -> BindGroupDescriptor<'a>
Get a
wgpu::BindGroupDescriptor
to build this bind group, using its layout and a reference to its
wgpu::BindGroupEntrys
from Self::bind_group_entries.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.