macro_rules! pipeline {
{ @len } => { ... };
{ @len $last:tt } => { ... };
{ @len $first:tt $( $rest:tt )+ } => { ... };
{ @texturefmt $var:ident , SURFACE } => { ... };
{ @texturefmt $var:ident , $fragmentfmt:ident } => { ... };
{ $struct:ident =>
bind_groups : [
$( $bindgroupnum:tt => $bindgroup:ty ),* $(,)?
],
vertex_types: [
$( $vertexnum:tt => $vertexty:ty ),* $(,)?
],
fragment_targets: [
$( $fragmentnum:tt => $blend:ident $mask:ident as $fragmentfmt:ident ),* $(,)?
],
push_constants: [
$( $pushfrom:literal .. $pushto:literal @ $pushshaderstage:ident ),* $(,)?
],
depth: $depthfmt:expr,
cull: $cull:expr,
} => { ... };
}
Expand description
Define a pipeline, with internal bind group types.
You need to number each field and include the total count of bind groups, it’s just a limitation of macros.
pipeline! { ThingPipeline {
bind_groups: [
0 StuffBindGroup,
1 CameraBindGroup,
2 TextureBindGroup,
],
} }
let thing_pipeline = StuffBindGroup::new(...);
queue.write_buffer(&stuff_bind_group.something_else_buffer, 0, &[1, 2, 3, ..]);