summaryrefslogtreecommitdiffstats
path: root/wgpu/src/triangle.rs
diff options
context:
space:
mode:
authorLibravatar Poly <marynczakbartlomiej@gmail.com>2022-07-04 01:17:29 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-07-09 17:07:38 +0200
commit15f794b7a89efb3299cb85b392ec13af145fb0fd (patch)
tree39d8c740168e4c09e15538451ba7f3899051ad43 /wgpu/src/triangle.rs
parente053e25d2ccb17f7a162685a106a8bbd915a873f (diff)
downloadiced-15f794b7a89efb3299cb85b392ec13af145fb0fd.tar.gz
iced-15f794b7a89efb3299cb85b392ec13af145fb0fd.tar.bz2
iced-15f794b7a89efb3299cb85b392ec13af145fb0fd.zip
Address Clippy lints
Diffstat (limited to 'wgpu/src/triangle.rs')
-rw-r--r--wgpu/src/triangle.rs74
1 files changed, 34 insertions, 40 deletions
diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs
index 40e2f855..fd06dddf 100644
--- a/wgpu/src/triangle.rs
+++ b/wgpu/src/triangle.rs
@@ -173,9 +173,7 @@ impl Pipeline {
},
depth_stencil: None,
multisample: wgpu::MultisampleState {
- count: u32::from(
- antialiasing.map(|a| a.sample_count()).unwrap_or(1),
- ),
+ count: antialiasing.map(|a| a.sample_count()).unwrap_or(1),
mask: !0,
alpha_to_coverage_enabled: false,
},
@@ -272,47 +270,43 @@ impl Pipeline {
let vertices = bytemuck::cast_slice(&mesh.buffers.vertices);
let indices = bytemuck::cast_slice(&mesh.buffers.indices);
- match (
+ if let (Some(vertices_size), Some(indices_size)) = (
wgpu::BufferSize::new(vertices.len() as u64),
wgpu::BufferSize::new(indices.len() as u64),
) {
- (Some(vertices_size), Some(indices_size)) => {
- {
- let mut vertex_buffer = staging_belt.write_buffer(
- encoder,
- &self.vertex_buffer.raw,
- (std::mem::size_of::<Vertex2D>() * last_vertex)
- as u64,
- vertices_size,
- device,
- );
-
- vertex_buffer.copy_from_slice(vertices);
- }
-
- {
- let mut index_buffer = staging_belt.write_buffer(
- encoder,
- &self.index_buffer.raw,
- (std::mem::size_of::<u32>() * last_index) as u64,
- indices_size,
- device,
- );
-
- index_buffer.copy_from_slice(indices);
- }
-
- uniforms.push(transform);
- offsets.push((
- last_vertex as u64,
- last_index as u64,
- mesh.buffers.indices.len(),
- ));
-
- last_vertex += mesh.buffers.vertices.len();
- last_index += mesh.buffers.indices.len();
+ {
+ let mut vertex_buffer = staging_belt.write_buffer(
+ encoder,
+ &self.vertex_buffer.raw,
+ (std::mem::size_of::<Vertex2D>() * last_vertex) as u64,
+ vertices_size,
+ device,
+ );
+
+ vertex_buffer.copy_from_slice(vertices);
+ }
+
+ {
+ let mut index_buffer = staging_belt.write_buffer(
+ encoder,
+ &self.index_buffer.raw,
+ (std::mem::size_of::<u32>() * last_index) as u64,
+ indices_size,
+ device,
+ );
+
+ index_buffer.copy_from_slice(indices);
}
- _ => {}
+
+ uniforms.push(transform);
+ offsets.push((
+ last_vertex as u64,
+ last_index as u64,
+ mesh.buffers.indices.len(),
+ ));
+
+ last_vertex += mesh.buffers.vertices.len();
+ last_index += mesh.buffers.indices.len();
}
}