pub fn new_from_device(wgpu_device: Device) -> Result<WGPURendererHandle<Device>> {
        let (default_shader, white_tex) = wgpu_device.with_device_info(|info| {
            let vs = include_bytes!("../shaders/default.vert.spv");
            let fs = include_bytes!("../shaders/default.frag.spv");
            let sprite_shader = WGPUShader::from_readers(
                info.device,
                std::io::Cursor::new(&vs[..]),
                std::io::Cursor::new(&fs[..]),
                wgpu::PrimitiveTopology::TriangleList,
            )?;

            let mut white_img = image::Image::new(1, 1);
            white_img.set_pixel(0, 0, Color::from([0xFF; 4]));
            let white_tex = WGPUTexture::from_image(
                info.device,
                info.queue,
                white_img,
                FilterMode::Nearest,
                FilterMode::Nearest,
                TextureType::Plain,
            )?
            .into();

            Ok((sprite_shader, white_tex))
        })?;

        let standard_res = StandardResources {
            default_shader,
            white_tex,
        };

        Ok(WGPURendererHandle::new(|weak_self| Self {
            weak_self,
            wgpu_device,
            standard_res,
        }))
    }
/// Or the renderer can be built on top of existing WGPU contexts, to allow the simple
/// renderer to be used on top of custom renderers.
Or the renderer can be built on top of existing WGPU contexts, to allow the simple
renderer to be used on top of custom renderers.
Or the renderer can be built on top of existing WGPU contexts to allow the simple renderer to be used on top of custom renderers .
pub fn new_from_device(wgpu_device: Device) -> Result<WGPURendererHandle<Device>> {
        let (default_shader, white_tex) = wgpu_device.with_device_info(|info| {
            let vs = include_bytes!("../shaders/default.vert.spv");
            let fs = include_bytes!("../shaders/default.frag.spv");
            let sprite_shader = WGPUShader::from_readers(
                info.device,
                std::io::Cursor::new(&vs[..]),
                std::io::Cursor::new(&fs[..]),
                wgpu::PrimitiveTopology::TriangleList,
            )?;
            let mut white_img = image::Image::new(1, 1);
            white_img.set_pixel(0, 0, Color::from([0xFF; 4]));
            let white_tex = WGPUTexture::from_image(
                info.device,
                info.queue,
                white_img,
                FilterMode::Nearest,
                FilterMode::Nearest,
                TextureType::Plain,
            )?
            .into();
            Ok((sprite_shader, white_tex))
        })?;
        let standard_res = StandardResources {
            default_shader,
            white_tex,
        };
        Ok(WGPURendererHandle::new(|weak_self| Self {
            weak_self,
            wgpu_device,
            standard_res,
        }))
    }
pub fn new_from_device ( wgpu_device : Device ) -> Result < WGPURendererHandle < Device > > { let ( default_shader , white_tex ) = wgpu_device . with_device_info ( | info | { let vs = include_bytes ! ( " " ) ; let fs = include_bytes ! ( " " ) ; let sprite_shader = WGPUShader :: from_readers ( info . device , std :: io :: Cursor :: new ( & vs [ .. ] ) , std :: io :: Cursor :: new ( & fs [ .. ] ) , wgpu :: PrimitiveTopology :: TriangleList , ) ? ; let mut white_img = image :: Image :: new ( 1 , 1 ) ; white_img . set_pixel ( 0 , 0 , Color :: from ( [ 0xFF ; 4 ] ) ) ; let white_tex = WGPUTexture :: from_image ( info . device , info . queue , white_img , FilterMode :: Nearest , FilterMode :: Nearest , TextureType :: Plain , ) ? . into ( ) ; Ok ( ( sprite_shader , white_tex ) ) } ) ? ; let standard_res = StandardResources { default_shader , white_tex , } ; Ok ( WGPURendererHandle :: new ( | weak_self | Self { weak_self , wgpu_device , standard_res , } ) ) }
Or the renderer can be built on top of existing WGPU contexts, to allow the simple
renderer to be used on top of custom renderers.
Or the renderer can be built on top of existing WGPU contexts to allow the simple renderer to be used on top of custom renderers .
wgpu_device
Device
wgpu_device
Device