fix nightly clippy lints (#2568)
Fix new nightly clippy lints on `pipelined-rendering`
This commit is contained in:
		
							parent
							
								
									0b800e547b
								
							
						
					
					
						commit
						7b336fd779
					
				| @ -53,7 +53,7 @@ pub struct AssetServerInternal { | |||||||
|     pub(crate) asset_ref_counter: AssetRefCounter, |     pub(crate) asset_ref_counter: AssetRefCounter, | ||||||
|     pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>, |     pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>, | ||||||
|     pub(crate) asset_lifecycles: Arc<RwLock<HashMap<Uuid, Box<dyn AssetLifecycle>>>>, |     pub(crate) asset_lifecycles: Arc<RwLock<HashMap<Uuid, Box<dyn AssetLifecycle>>>>, | ||||||
|     loaders: RwLock<Vec<Arc<Box<dyn AssetLoader>>>>, |     loaders: RwLock<Vec<Arc<dyn AssetLoader>>>, | ||||||
|     extension_to_loader_index: RwLock<HashMap<String, usize>>, |     extension_to_loader_index: RwLock<HashMap<String, usize>>, | ||||||
|     handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>, |     handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>, | ||||||
|     task_pool: TaskPool, |     task_pool: TaskPool, | ||||||
| @ -112,7 +112,7 @@ impl AssetServer { | |||||||
|                 .write() |                 .write() | ||||||
|                 .insert(extension.to_string(), loader_index); |                 .insert(extension.to_string(), loader_index); | ||||||
|         } |         } | ||||||
|         loaders.push(Arc::new(Box::new(loader))); |         loaders.push(Arc::new(loader)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub fn watch_for_changes(&self) -> Result<(), AssetServerError> { |     pub fn watch_for_changes(&self) -> Result<(), AssetServerError> { | ||||||
| @ -130,10 +130,7 @@ impl AssetServer { | |||||||
|         HandleUntyped::strong(id.into(), sender) |         HandleUntyped::strong(id.into(), sender) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn get_asset_loader( |     fn get_asset_loader(&self, extension: &str) -> Result<Arc<dyn AssetLoader>, AssetServerError> { | ||||||
|         &self, |  | ||||||
|         extension: &str, |  | ||||||
|     ) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> { |  | ||||||
|         let index = { |         let index = { | ||||||
|             // scope map to drop lock as soon as possible
 |             // scope map to drop lock as soon as possible
 | ||||||
|             let map = self.server.extension_to_loader_index.read(); |             let map = self.server.extension_to_loader_index.read(); | ||||||
| @ -149,7 +146,7 @@ impl AssetServer { | |||||||
|     fn get_path_asset_loader<P: AsRef<Path>>( |     fn get_path_asset_loader<P: AsRef<Path>>( | ||||||
|         &self, |         &self, | ||||||
|         path: P, |         path: P, | ||||||
|     ) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> { |     ) -> Result<Arc<dyn AssetLoader>, AssetServerError> { | ||||||
|         let s = path |         let s = path | ||||||
|             .as_ref() |             .as_ref() | ||||||
|             .file_name() |             .file_name() | ||||||
|  | |||||||
| @ -631,39 +631,37 @@ pub fn queue_meshes( | |||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 1, |                                     binding: 1, | ||||||
|                                     resource: BindingResource::TextureView( |                                     resource: BindingResource::TextureView(base_color_texture_view), | ||||||
|                                         &base_color_texture_view, |  | ||||||
|                                     ), |  | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 2, |                                     binding: 2, | ||||||
|                                     resource: BindingResource::Sampler(&base_color_sampler), |                                     resource: BindingResource::Sampler(base_color_sampler), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 3, |                                     binding: 3, | ||||||
|                                     resource: BindingResource::TextureView(&emissive_texture_view), |                                     resource: BindingResource::TextureView(emissive_texture_view), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 4, |                                     binding: 4, | ||||||
|                                     resource: BindingResource::Sampler(&emissive_sampler), |                                     resource: BindingResource::Sampler(emissive_sampler), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 5, |                                     binding: 5, | ||||||
|                                     resource: BindingResource::TextureView( |                                     resource: BindingResource::TextureView( | ||||||
|                                         &metallic_roughness_texture_view, |                                         metallic_roughness_texture_view, | ||||||
|                                     ), |                                     ), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 6, |                                     binding: 6, | ||||||
|                                     resource: BindingResource::Sampler(&metallic_roughness_sampler), |                                     resource: BindingResource::Sampler(metallic_roughness_sampler), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 7, |                                     binding: 7, | ||||||
|                                     resource: BindingResource::TextureView(&occlusion_texture_view), |                                     resource: BindingResource::TextureView(occlusion_texture_view), | ||||||
|                                 }, |                                 }, | ||||||
|                                 BindGroupEntry { |                                 BindGroupEntry { | ||||||
|                                     binding: 8, |                                     binding: 8, | ||||||
|                                     resource: BindingResource::Sampler(&occlusion_sampler), |                                     resource: BindingResource::Sampler(occlusion_sampler), | ||||||
|                                 }, |                                 }, | ||||||
|                             ], |                             ], | ||||||
|                             label: None, |                             label: None, | ||||||
|  | |||||||
| @ -210,34 +210,34 @@ impl Mesh { | |||||||
|         for (_, attributes) in self.attributes.iter_mut() { |         for (_, attributes) in self.attributes.iter_mut() { | ||||||
|             let indices = indices.iter(); |             let indices = indices.iter(); | ||||||
|             match attributes { |             match attributes { | ||||||
|                 VertexAttributeValues::Float32(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Float32(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint32(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint32(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint32(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint32(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Float32x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Float32x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint32x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint32x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint32x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint32x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Float32x3(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Float32x3(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint32x3(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint32x3(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint32x3(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint32x3(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint32x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint32x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint32x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint32x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Float32x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Float32x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint16x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint16x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Snorm16x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Snorm16x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint16x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint16x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Unorm16x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Unorm16x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint16x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint16x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Snorm16x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Snorm16x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint16x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint16x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Unorm16x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Unorm16x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint8x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint8x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Snorm8x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Snorm8x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint8x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint8x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Unorm8x2(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Unorm8x2(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Sint8x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Sint8x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Snorm8x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Snorm8x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Uint8x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Uint8x4(vec) => *vec = duplicate(vec, indices), | ||||||
|                 VertexAttributeValues::Unorm8x4(vec) => *vec = duplicate(&vec, indices), |                 VertexAttributeValues::Unorm8x4(vec) => *vec = duplicate(vec, indices), | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -560,7 +560,7 @@ impl RenderAsset for Mesh { | |||||||
|         let index_info = mesh.get_index_buffer_bytes().map(|data| GpuIndexInfo { |         let index_info = mesh.get_index_buffer_bytes().map(|data| GpuIndexInfo { | ||||||
|             buffer: render_device.create_buffer_with_data(&BufferInitDescriptor { |             buffer: render_device.create_buffer_with_data(&BufferInitDescriptor { | ||||||
|                 usage: BufferUsage::INDEX, |                 usage: BufferUsage::INDEX, | ||||||
|                 contents: &data, |                 contents: data, | ||||||
|                 label: None, |                 label: None, | ||||||
|             }), |             }), | ||||||
|             count: mesh.indices().unwrap().len() as u32, |             count: mesh.indices().unwrap().len() as u32, | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ pub async fn initialize_renderer( | |||||||
|     let instance = wgpu::Instance::new(backends); |     let instance = wgpu::Instance::new(backends); | ||||||
| 
 | 
 | ||||||
|     let adapter = instance |     let adapter = instance | ||||||
|         .request_adapter(&request_adapter_options) |         .request_adapter(request_adapter_options) | ||||||
|         .await |         .await | ||||||
|         .expect("Unable to find a GPU! Make sure you have installed required drivers!"); |         .expect("Unable to find a GPU! Make sure you have installed required drivers!"); | ||||||
| 
 | 
 | ||||||
| @ -55,7 +55,7 @@ pub async fn initialize_renderer( | |||||||
|     let trace_path = None; |     let trace_path = None; | ||||||
| 
 | 
 | ||||||
|     let (device, queue) = adapter |     let (device, queue) = adapter | ||||||
|         .request_device(&device_descriptor, trace_path) |         .request_device(device_descriptor, trace_path) | ||||||
|         .await |         .await | ||||||
|         .unwrap(); |         .unwrap(); | ||||||
|     let device = Arc::new(device); |     let device = Arc::new(device); | ||||||
|  | |||||||
| @ -66,13 +66,13 @@ impl Shader { | |||||||
|     pub fn reflect(&self) -> Result<ShaderReflection, ShaderReflectError> { |     pub fn reflect(&self) -> Result<ShaderReflection, ShaderReflectError> { | ||||||
|         let module = match &self { |         let module = match &self { | ||||||
|             // TODO: process macros here
 |             // TODO: process macros here
 | ||||||
|             Shader::Wgsl(source) => naga::front::wgsl::parse_str(&source)?, |             Shader::Wgsl(source) => naga::front::wgsl::parse_str(source)?, | ||||||
|             Shader::Glsl(source) => { |             Shader::Glsl(source) => { | ||||||
|                 let mut entry_points = HashMap::default(); |                 let mut entry_points = HashMap::default(); | ||||||
|                 entry_points.insert("vertex".to_string(), ShaderStage::Vertex); |                 entry_points.insert("vertex".to_string(), ShaderStage::Vertex); | ||||||
|                 entry_points.insert("fragment".to_string(), ShaderStage::Fragment); |                 entry_points.insert("fragment".to_string(), ShaderStage::Fragment); | ||||||
|                 naga::front::glsl::parse_str( |                 naga::front::glsl::parse_str( | ||||||
|                     &source, |                     source, | ||||||
|                     &naga::front::glsl::Options { |                     &naga::front::glsl::Options { | ||||||
|                         entry_points, |                         entry_points, | ||||||
|                         defines: Default::default(), |                         defines: Default::default(), | ||||||
| @ -80,7 +80,7 @@ impl Shader { | |||||||
|                 )? |                 )? | ||||||
|             } |             } | ||||||
|             Shader::SpirV(source) => naga::front::spv::parse_u8_slice( |             Shader::SpirV(source) => naga::front::spv::parse_u8_slice( | ||||||
|                 &source, |                 source, | ||||||
|                 &naga::front::spv::Options { |                 &naga::front::spv::Options { | ||||||
|                     adjust_coordinate_space: false, |                     adjust_coordinate_space: false, | ||||||
|                     ..naga::front::spv::Options::default() |                     ..naga::front::spv::Options::default() | ||||||
|  | |||||||
| @ -89,7 +89,7 @@ impl Image { | |||||||
|         ); |         ); | ||||||
| 
 | 
 | ||||||
|         for current_pixel in value.data.chunks_exact_mut(pixel.len()) { |         for current_pixel in value.data.chunks_exact_mut(pixel.len()) { | ||||||
|             current_pixel.copy_from_slice(&pixel); |             current_pixel.copy_from_slice(pixel); | ||||||
|         } |         } | ||||||
|         value |         value | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Carter Anderson
						Carter Anderson