Skip to main content

mew/
doc_example.rs

1//! Example module to show available methods on generated structs. Check the
2//! source code to see how they're defined.
3
4crate::vertex_struct! { ExampleVertexStruct step Vertex + 5 [
5    0 ints => Uint8,
6    1 norms => Snorm8x4,
7    2 floats => Float32x3,
8] }
9
10crate::buffer! { VertexBuffer <ExampleVertexStruct> as STORAGE | VERTEX | COPY_DST }
11
12
13crate::shader_struct! { ExampleShaderStruct [
14    0 int => I32,
15    1 mat => Mat4x4f,
16    2 float => F32,
17] }
18
19crate::buffer! { ShaderBuffer <ExampleShaderStruct> as STORAGE | COPY_DST }
20
21
22crate::sampler! { Sampler as Filtering {
23    mag_filter: Nearest,
24} }
25
26crate::texture! { Texture {
27    usage: TEXTURE_BINDING | COPY_DST,
28    dimension: D2,
29    sample_type: FLOAT,
30} }
31
32
33crate::bind_group! { ExampleBindGroup [
34    0 sampler @ FRAGMENT => Sampler,
35    1 texture @ FRAGMENT | VERTEX => Texture,
36    2 buffer @ VERTEX => ShaderBuffer,
37] }
38
39
40crate::pipeline! { ExamplePipeline {
41    bind_groups: [
42        0 => ExampleBindGroup,
43    ],
44    vertex_types: [
45        0 => ExampleVertexStruct,
46    ],
47    fragment_targets: [
48        0 => ALPHA_BLENDING ALL as ANY,
49    ],
50    immediate_size: 4,
51    depth: Some(Depth32Float),
52    cull: Some(Front),
53} }