mew/
doc_example.rs

1crate::vertex_struct! { ExampleVertexStruct step Vertex [
2    0 ints => Uint16x2,
3    1 norms => Snorm8x4,
4    2 floats => Float32x3,
5] }
6
7crate::buffer! { VertexBuffer <ExampleVertexStruct> as STORAGE | VERTEX | COPY_DST }
8
9
10crate::shader_struct! { ExampleShaderStruct [
11    0 int => I32,
12    1 mat => Mat4x4f,
13] }
14
15crate::buffer! { ShaderBuffer <ExampleShaderStruct> as STORAGE | COPY_DST }
16
17
18crate::sampler! { Sampler as Filtering {
19    mag_filter: Nearest,
20} }
21
22crate::texture! { Texture {
23    usage: TEXTURE_BINDING | COPY_DST,
24    dimension: D2,
25    sample_type: FloatFiltering,
26} }
27
28
29crate::bind_group! { ExampleBindGroup [
30    0 sampler @ FRAGMENT => Sampler,
31    1 texture @ FRAGMENT | VERTEX => std::sync::Arc<Texture> as Texture,
32    2 buffer @ VERTEX => ShaderBuffer,
33] }
34
35
36crate::pipeline! { ExamplePipeline {
37    bind_groups: [
38        0 => ExampleBindGroup,
39    ],
40    vertex_types: [
41        0 => ExampleVertexStruct,
42    ],
43    fragment_targets: [
44        0 => ALPHA_BLENDING ALL as SURFACE,
45    ],
46    push_constants: [
47        0..4 @ VERTEX,
48    ],
49    depth: None,
50    cull: Some(Front),
51} }