Run cargo fmt

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 04:35:16 +01:00
parent 20a0577034
commit b957453404
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
17 changed files with 95 additions and 107 deletions

View file

@ -94,7 +94,7 @@ impl Backend {
staging_belt,
encoder,
frame,
target_size
target_size,
);
}

View file

@ -56,11 +56,7 @@ impl<T: Pod + Zeroable> StaticBuffer<T> {
/// Returns whether or not the buffer needs to be recreated. This can happen whenever mesh data
/// changes & a redraw is requested.
pub fn resize(
&mut self,
device: &wgpu::Device,
new_count: usize,
) -> bool {
pub fn resize(&mut self, device: &wgpu::Device, new_count: usize) -> bool {
let size =
wgpu::BufferAddress::from((mem::size_of::<T>() * new_count) as u64);

View file

@ -65,9 +65,7 @@ impl<T: ShaderType + WriteInto> Buffer<T> {
pub fn uniform(device: &wgpu::Device, label: &'static str) -> Self {
Buffer::new(
device,
BufferType::Uniform(encase::DynamicUniformBuffer::new(
Vec::new(),
)),
BufferType::Uniform(encase::DynamicUniformBuffer::new(Vec::new())),
label,
wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
)
@ -77,9 +75,7 @@ impl<T: ShaderType + WriteInto> Buffer<T> {
pub fn storage(device: &wgpu::Device, label: &'static str) -> Self {
Buffer::new(
device,
BufferType::Storage(encase::DynamicStorageBuffer::new(
Vec::new(),
)),
BufferType::Storage(encase::DynamicStorageBuffer::new(Vec::new())),
label,
wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
)

View file

@ -42,8 +42,8 @@ pub mod settings;
pub mod triangle;
pub mod window;
mod buffers;
mod backend;
mod buffers;
mod quad;
mod text;

View file

@ -3,15 +3,15 @@ use crate::{settings, Transformation};
use core::fmt;
use std::fmt::Formatter;
use iced_graphics::layer::{Mesh, mesh};
use iced_graphics::layer::{mesh, Mesh};
use iced_graphics::Size;
use crate::buffers::StaticBuffer;
pub use iced_graphics::triangle::{Mesh2D, Vertex2D};
mod solid;
mod gradient;
mod msaa;
mod solid;
/// Triangle pipeline for all mesh layers in a [`iced_graphics::Canvas`] widget.
#[derive(Debug)]
@ -103,9 +103,7 @@ impl Pipeline {
//We are not currently using the return value of these functions as we have no system in
//place to calculate mesh diff, or to know whether or not that would be more performant for
//the majority of use cases. Therefore we will write GPU data every frame (for now).
let _ = self
.vertex_buffer
.resize(device, total_vertices);
let _ = self.vertex_buffer.resize(device, total_vertices);
let _ = self.index_buffer.resize(device, total_indices);
//prepare dynamic buffers & data store for writing