pub(crate) async fn create(window: &Window) -> Self {
        let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);

        let surface = unsafe { instance.create_surface(window) };

        let adapter = instance
            .request_adapter(&wgpu::RequestAdapterOptions {
                power_preference: wgpu::PowerPreference::default(),
                compatible_surface: Some(&surface),
            })
            .await
            .unwrap();

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

        let size = window.inner_size();

        let surface_config = wgpu::SurfaceConfiguration {
            usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
            format: surface.get_preferred_format(&adapter).unwrap(),
            width: size.width,
            height: size.height,
            present_mode: wgpu::PresentMode::Mailbox,
        };

        surface.configure(&device, &surface_config);

        RendererBase {
            surface,
            surface_config,
            device,
            queue,
        }
    }
/// Creates the surface, device, queue, and swapchain for a Window.
Creates the surface, device, queue, and swapchain for a Window.
Creates the surface device queue and swapchain for a Window .
pub(crate) async fn create(window: &Window) -> Self {
        let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY);
        let surface = unsafe { instance.create_surface(window) };
        let adapter = instance
            .request_adapter(&wgpu::RequestAdapterOptions {
                power_preference: wgpu::PowerPreference::default(),
                compatible_surface: Some(&surface),
            })
            .await
            .unwrap();
        let (device, queue) = adapter
            .request_device(
                &wgpu::DeviceDescriptor {
                    label: None,
                    features: wgpu::Features::empty(),
                    limits: wgpu::Limits::default(),
                },
                None,
            )
            .await
            .unwrap();
        let size = window.inner_size();
        let surface_config = wgpu::SurfaceConfiguration {
            usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
            format: surface.get_preferred_format(&adapter).unwrap(),
            width: size.width,
            height: size.height,
            present_mode: wgpu::PresentMode::Mailbox,
        };
        surface.configure(&device, &surface_config);
        RendererBase {
            surface,
            surface_config,
            device,
            queue,
        }
    }
pub ( crate ) async fn create ( window : & Window ) -> Self { let instance = wgpu :: Instance :: new ( wgpu :: Backends :: PRIMARY ) ; let surface = unsafe { instance . create_surface ( window ) } ; let adapter = instance . request_adapter ( & wgpu :: RequestAdapterOptions { power_preference : wgpu :: PowerPreference :: default ( ) , compatible_surface : Some ( & surface ) , } ) . await . unwrap ( ) ; let ( device , queue ) = adapter . request_device ( & wgpu :: DeviceDescriptor { label : None , features : wgpu :: Features :: empty ( ) , limits : wgpu :: Limits :: default ( ) , } , None , ) . await . unwrap ( ) ; let size = window . inner_size ( ) ; let surface_config = wgpu :: SurfaceConfiguration { usage : wgpu :: TextureUsages :: RENDER_ATTACHMENT , format : surface . get_preferred_format ( & adapter ) . unwrap ( ) , width : size . width , height : size . height , present_mode : wgpu :: PresentMode :: Mailbox , } ; surface . configure ( & device , & surface_config ) ; RendererBase { surface , surface_config , device , queue , } }
Creates the surface, device, queue, and swapchain for a Window.
Creates the surface device queue and swapchain for a Window .
window
&Window