# shader.rs - source
Source of the Rust file `maplibre/src/render/resource/shader.rs`.
Keywords: rust, rustlang, rust-lang

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35

    //! Utilities for creating shader states.

    /// Describes how the vertex buffer is interpreted.
    #[derive(Clone, Debug)]
    pub struct VertexBufferLayout {
        /// The stride, in bytes, between elements of this buffer.
        pub array_stride: wgpu::BufferAddress,
        /// How often this vertex buffer is "stepped" forward.
        pub step_mode: wgpu::VertexStepMode,
        /// The list of attributes which comprise a single vertex.
        pub attributes: Vec<wgpu::VertexAttribute>,
    }

    /// Describes the fragment process in a render pipeline.
    #[derive(Clone, Debug, PartialEq)]
    pub struct FragmentState {
        /// The shader source
        pub source: &'static str,
        /// The name of the entry point in the compiled shader. There must be a
        /// function with this name in the shader.
        pub entry_point: &'static str,
        /// The color state of the render targets.
        pub targets: Vec<wgpu::ColorTargetState>,
    }

    #[derive(Clone, Debug)]
    pub struct VertexState {
        /// The shader source
        pub source: &'static str,
        /// The name of the entry point in the compiled shader. There must be a
        /// function with this name in the shader.
        pub entry_point: &'static str,
        /// The format of any vertex buffers used with this pipeline.
        pub buffers: Vec<VertexBufferLayout>,
    }