pub async fn for_surface(
        surface: wgpu::Surface,
        instance: &wgpu::Instance,
        sample_count: u32,
    ) -> Result<Self, ParrotError> {
        log::info!("Creating for surface");
        let adapter = instance.request_adapter(&wgpu::RequestAdapterOptions {
            power_preference: wgpu::PowerPreference::default(),
            compatible_surface: Some(&surface),
            force_fallback_adapter: false,
        }).await.ok_or(ParrotError::NoAdaptersFound)?;

        let preferred_format = surface.get_preferred_format(&adapter).expect("Adapter incompatible with surface");

        Ok(Self {
            device: Device::for_surface(surface, &adapter).await?,
            sample_count,
            pref_format: preferred_format
        })
    }
/// Setup painter for a surface.
Setup painter for a surface.
Setup painter for a surface .
pub async fn for_surface(
        surface: wgpu::Surface,
        instance: &wgpu::Instance,
        sample_count: u32,
    ) -> Result<Self, ParrotError> {
        log::info!("Creating for surface");
        let adapter = instance.request_adapter(&wgpu::RequestAdapterOptions {
            power_preference: wgpu::PowerPreference::default(),
            compatible_surface: Some(&surface),
            force_fallback_adapter: false,
        }).await.ok_or(ParrotError::NoAdaptersFound)?;
        let preferred_format = surface.get_preferred_format(&adapter).expect("Adapter incompatible with surface");
        Ok(Self {
            device: Device::for_surface(surface, &adapter).await?,
            sample_count,
            pref_format: preferred_format
        })
    }
pub async fn for_surface ( surface : wgpu :: Surface , instance : & wgpu :: Instance , sample_count : u32 , ) -> Result < Self , ParrotError > { log :: info ! ( " " ) ; let adapter = instance . request_adapter ( & wgpu :: RequestAdapterOptions { power_preference : wgpu :: PowerPreference :: default ( ) , compatible_surface : Some ( & surface ) , force_fallback_adapter : false , } ) . await . ok_or ( ParrotError :: NoAdaptersFound ) ? ; let preferred_format = surface . get_preferred_format ( & adapter ) . expect ( " " ) ; Ok ( Self { device : Device :: for_surface ( surface , & adapter ) . await ? , sample_count , pref_format : preferred_format } ) }
Setup painter for a surface.
Setup painter for a surface .
surface
wgpu::Surface
instance
&wgpu::Instance
sample_count
u32