# phase_sort_stage.rs - source
Source of the Rust file `maplibre/src/render/stages/phase_sort_stage.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

    //! Sorts items of the [RenderPhases](RenderPhase).

    use crate::context::MapContext;
    use crate::coords::{ViewRegion, Zoom};
    use crate::io::tile_repository::TileRepository;
    use crate::render::camera::ViewProjection;
    use crate::render::render_phase::RenderPhase;
    use crate::render::resource::IndexEntry;
    use crate::render::shaders::{
        ShaderCamera, ShaderFeatureStyle, ShaderGlobals, ShaderLayerMetadata, Vec4f32,
    };
    use crate::render::tile_view_pattern::TileInView;
    use crate::render::util::Eventually::Initialized;
    use crate::schedule::Stage;
    use crate::{RenderState, Renderer, Style};
    use std::iter;

    #[derive(Default)]
    pub struct PhaseSortStage;

    impl Stage for PhaseSortStage {
        fn run(
            &mut self,
            MapContext {
                renderer: Renderer { state, .. },
                ..
            }: &mut MapContext,
        ) {
            let mask_phase: &mut RenderPhase<_> = &mut state.mask_phase;
            mask_phase.sort();
            let file_phase = &mut state.tile_phase;
            file_phase.sort();
        }
    }