pub unsafe fn new(window: &winit::window::Window, msaa_samples: u32) -> Self {
        let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY | wgpu::Backends::GL);
        let surface = instance.create_surface(&window);

        let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
            power_preference: wgpu::PowerPreference::HighPerformance,
            compatible_surface: Some(&surface),
            force_fallback_adapter: false,
        }))
        .unwrap();

        let (device, queue) = pollster::block_on(adapter.request_device(
            &wgpu::DeviceDescriptor {
                features: wgpu::Features::default(),
                limits: wgpu::Limits::default(),
                label: None,
            },
            None,
        ))
        .unwrap();

        let size = window.inner_size();
        let surface_format = surface.get_preferred_format(&adapter).unwrap();
        let surface_config = wgpu::SurfaceConfiguration {
            usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
            format: surface_format,
            width: size.width as u32,
            height: size.height as u32,
            present_mode: wgpu::PresentMode::Fifo, // TODO: make vsync configurable
        };
        surface.configure(&device, &surface_config);

        let egui_rpass = renderer::RenderPass::new(&device, surface_format, msaa_samples);

        Self {
            device,
            queue,
            surface_config,
            surface,
            egui_rpass,
        }
    }
/// Creates a [`wgpu`] surface for the given window, and things required to render egui onto it.
///
/// # Safety
/// The given `window` must outlive the returned [`Painter`].
Creates a [`wgpu`] surface for the given window, and things required to render egui onto it.
Creates a [ ` wgpu ` ] surface for the given window and things required to render egui onto it .
pub unsafe fn new(window: &winit::window::Window, msaa_samples: u32) -> Self {
        let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY | wgpu::Backends::GL);
        let surface = instance.create_surface(&window);
        let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
            power_preference: wgpu::PowerPreference::HighPerformance,
            compatible_surface: Some(&surface),
            force_fallback_adapter: false,
        }))
        .unwrap();
        let (device, queue) = pollster::block_on(adapter.request_device(
            &wgpu::DeviceDescriptor {
                features: wgpu::Features::default(),
                limits: wgpu::Limits::default(),
                label: None,
            },
            None,
        ))
        .unwrap();
        let size = window.inner_size();
        let surface_format = surface.get_preferred_format(&adapter).unwrap();
        let surface_config = wgpu::SurfaceConfiguration {
            usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
            format: surface_format,
            width: size.width as u32,
            height: size.height as u32,
            present_mode: wgpu::PresentMode::Fifo, // TODO: make vsync configurable
        };
        surface.configure(&device, &surface_config);
        let egui_rpass = renderer::RenderPass::new(&device, surface_format, msaa_samples);
        Self {
            device,
            queue,
            surface_config,
            surface,
            egui_rpass,
        }
    }
pub unsafe fn new ( window : & winit :: window :: Window , msaa_samples : u32 ) -> Self { let instance = wgpu :: Instance :: new ( wgpu :: Backends :: PRIMARY | wgpu :: Backends :: GL ) ; let surface = instance . create_surface ( & window ) ; let adapter = pollster :: block_on ( instance . request_adapter ( & wgpu :: RequestAdapterOptions { power_preference : wgpu :: PowerPreference :: HighPerformance , compatible_surface : Some ( & surface ) , force_fallback_adapter : false , } ) ) . unwrap ( ) ; let ( device , queue ) = pollster :: block_on ( adapter . request_device ( & wgpu :: DeviceDescriptor { features : wgpu :: Features :: default ( ) , limits : wgpu :: Limits :: default ( ) , label : None , } , None , ) ) . unwrap ( ) ; let size = window . inner_size ( ) ; let surface_format = surface . get_preferred_format ( & adapter ) . unwrap ( ) ; let surface_config = wgpu :: SurfaceConfiguration { usage : wgpu :: TextureUsages :: RENDER_ATTACHMENT , format : surface_format , width : size . width as u32 , height : size . height as u32 , present_mode : wgpu :: PresentMode :: Fifo , // TODO: make vsync configurable } ; surface . configure ( & device , & surface_config ) ; let egui_rpass = renderer :: RenderPass :: new ( & device , surface_format , msaa_samples ) ; Self { device , queue , surface_config , surface , egui_rpass , } }
Creates a [`wgpu`] surface for the given window, and things required to render egui onto it.
Creates a [ ` wgpu ` ] surface for the given window and things required to render egui onto it .
window
&winit::window::Window
msaa_samples
u32
window
&winit::window::Window
msaa_samples
u32
safety
The given `window` must outlive the returned [`Painter`].
The given ` window ` must outlive the returned [ ` Painter ` ] .