diff --git a/src/lib.rs b/src/lib.rs index c9443eb..ce08895 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ use std::rc::Rc; use vk_shader_macros::include_glsl; pub use wgpu; +use wgpu::TextureView; mod render_pass; pub use render_pass::RenderPass; @@ -24,7 +25,7 @@ pub use render_pass::RenderPass; type RPObject = Box; type RPDevice = Rc; type RPQueue = Rc>; -type RPTexture = wgpu::TextureView; +type RenderPassFactory = Box RPObject>; /// A logical texture for a window surface. #[derive(Debug)] @@ -57,7 +58,7 @@ pub struct PixelsBuilder<'a> { pixel_aspect_ratio: f64, surface_texture: SurfaceTexture<'a>, texture_format: wgpu::TextureFormat, - renderer_factories: Vec RPObject>>, + renderer_factories: Vec, } /// Renderer implements RenderPass. @@ -139,11 +140,7 @@ impl Pixels { /// # Panics /// /// Panics when `width` or `height` are 0. - pub fn new<'a>( - width: u32, - height: u32, - surface_texture: SurfaceTexture<'a>, - ) -> Result { + pub fn new(width: u32, height: u32, surface_texture: SurfaceTexture) -> Result { PixelsBuilder::new(width, height, surface_texture).build() } @@ -175,12 +172,12 @@ impl Pixels { } impl RenderPass for Renderer { - fn update_bindings(&mut self, _texture_view: &wgpu::TextureView) {} + fn update_bindings(&mut self, _texture_view: &TextureView) {} fn render_pass( &self, encoder: &mut wgpu::CommandEncoder, - render_target: &wgpu::TextureView, + render_target: &TextureView, texels: &[u8], ) { // Update the pixel buffer texture view @@ -330,7 +327,7 @@ impl<'a> PixelsBuilder<'a> { /// render pass. pub fn add_render_pass( mut self, - factory: impl Fn(RPDevice, RPQueue, &RPTexture) -> RPObject + 'static, + factory: impl Fn(RPDevice, RPQueue, &TextureView) -> RPObject + 'static, ) -> PixelsBuilder<'a> { self.renderer_factories.push(Box::new(factory)); self