clippy
This commit is contained in:
parent
c994b35a5c
commit
889d1ae44a
1 changed files with 7 additions and 10 deletions
17
src/lib.rs
17
src/lib.rs
|
@ -16,6 +16,7 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use vk_shader_macros::include_glsl;
|
use vk_shader_macros::include_glsl;
|
||||||
pub use wgpu;
|
pub use wgpu;
|
||||||
|
use wgpu::TextureView;
|
||||||
|
|
||||||
mod render_pass;
|
mod render_pass;
|
||||||
pub use render_pass::RenderPass;
|
pub use render_pass::RenderPass;
|
||||||
|
@ -24,7 +25,7 @@ pub use render_pass::RenderPass;
|
||||||
type RPObject = Box<dyn RenderPass>;
|
type RPObject = Box<dyn RenderPass>;
|
||||||
type RPDevice = Rc<wgpu::Device>;
|
type RPDevice = Rc<wgpu::Device>;
|
||||||
type RPQueue = Rc<RefCell<wgpu::Queue>>;
|
type RPQueue = Rc<RefCell<wgpu::Queue>>;
|
||||||
type RPTexture = wgpu::TextureView;
|
type RenderPassFactory = Box<dyn Fn(RPDevice, RPQueue, &TextureView) -> RPObject>;
|
||||||
|
|
||||||
/// A logical texture for a window surface.
|
/// A logical texture for a window surface.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -57,7 +58,7 @@ pub struct PixelsBuilder<'a> {
|
||||||
pixel_aspect_ratio: f64,
|
pixel_aspect_ratio: f64,
|
||||||
surface_texture: SurfaceTexture<'a>,
|
surface_texture: SurfaceTexture<'a>,
|
||||||
texture_format: wgpu::TextureFormat,
|
texture_format: wgpu::TextureFormat,
|
||||||
renderer_factories: Vec<Box<dyn Fn(RPDevice, RPQueue, &RPTexture) -> RPObject>>,
|
renderer_factories: Vec<RenderPassFactory>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renderer implements RenderPass.
|
/// Renderer implements RenderPass.
|
||||||
|
@ -139,11 +140,7 @@ impl Pixels {
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// Panics when `width` or `height` are 0.
|
/// Panics when `width` or `height` are 0.
|
||||||
pub fn new<'a>(
|
pub fn new(width: u32, height: u32, surface_texture: SurfaceTexture) -> Result<Pixels, Error> {
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
surface_texture: SurfaceTexture<'a>,
|
|
||||||
) -> Result<Pixels, Error> {
|
|
||||||
PixelsBuilder::new(width, height, surface_texture).build()
|
PixelsBuilder::new(width, height, surface_texture).build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,12 +172,12 @@ impl Pixels {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderPass for Renderer {
|
impl RenderPass for Renderer {
|
||||||
fn update_bindings(&mut self, _texture_view: &wgpu::TextureView) {}
|
fn update_bindings(&mut self, _texture_view: &TextureView) {}
|
||||||
|
|
||||||
fn render_pass(
|
fn render_pass(
|
||||||
&self,
|
&self,
|
||||||
encoder: &mut wgpu::CommandEncoder,
|
encoder: &mut wgpu::CommandEncoder,
|
||||||
render_target: &wgpu::TextureView,
|
render_target: &TextureView,
|
||||||
texels: &[u8],
|
texels: &[u8],
|
||||||
) {
|
) {
|
||||||
// Update the pixel buffer texture view
|
// Update the pixel buffer texture view
|
||||||
|
@ -330,7 +327,7 @@ impl<'a> PixelsBuilder<'a> {
|
||||||
/// render pass.
|
/// render pass.
|
||||||
pub fn add_render_pass(
|
pub fn add_render_pass(
|
||||||
mut self,
|
mut self,
|
||||||
factory: impl Fn(RPDevice, RPQueue, &RPTexture) -> RPObject + 'static,
|
factory: impl Fn(RPDevice, RPQueue, &TextureView) -> RPObject + 'static,
|
||||||
) -> PixelsBuilder<'a> {
|
) -> PixelsBuilder<'a> {
|
||||||
self.renderer_factories.push(Box::new(factory));
|
self.renderer_factories.push(Box::new(factory));
|
||||||
self
|
self
|
||||||
|
|
Loading…
Add table
Reference in a new issue