pub fn queue_pipelines_system(
    mut commands: Commands,
    pipeline_cache: Res<PipelineCache>,
    mut specialized_pipelines: ResMut<SpecializedRenderPipelines<EguiPipeline>>,
    egui_pipeline: Res<EguiPipeline>,
    windows: Res<ExtractedWindows>,
    render_to_image: Query<(&MainEntity, &EguiRenderToImage)>,
    images: Res<RenderAssets<GpuImage>>,
) {
    let mut pipelines: HashMap<MainEntity, CachedRenderPipelineId> = windows
        .iter()
        .filter_map(|(window_id, window)| {
            let key = EguiPipelineKey::from_extracted_window(window)?;
            let pipeline_id =
                specialized_pipelines.specialize(&pipeline_cache, &egui_pipeline, key);
            Some((MainEntity::from(*window_id), pipeline_id))
        })
        .collect();

    pipelines.extend(
        render_to_image
            .iter()
            .filter_map(|(main_entity, render_to_image)| {
                let img = images.get(&render_to_image.handle)?;
                let key = EguiPipelineKey::from_gpu_image(img);
                let pipeline_id =
                    specialized_pipelines.specialize(&pipeline_cache, &egui_pipeline, key);

                Some((*main_entity, pipeline_id))
            }),
    );

    commands.insert_resource(EguiPipelines(pipelines));
}
Queue [`EguiPipeline`] instances specialized on each window's swap chain texture format.
src/render_systems.rs