mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
fix nightly clippy lints (#2568)
Fix new nightly clippy lints on `pipelined-rendering`
This commit is contained in:
parent
0b800e547b
commit
7b336fd779
6 changed files with 47 additions and 52 deletions
|
@ -53,7 +53,7 @@ pub struct AssetServerInternal {
|
|||
pub(crate) asset_ref_counter: AssetRefCounter,
|
||||
pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>,
|
||||
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>>,
|
||||
handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>,
|
||||
task_pool: TaskPool,
|
||||
|
@ -112,7 +112,7 @@ impl AssetServer {
|
|||
.write()
|
||||
.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> {
|
||||
|
@ -130,10 +130,7 @@ impl AssetServer {
|
|||
HandleUntyped::strong(id.into(), sender)
|
||||
}
|
||||
|
||||
fn get_asset_loader(
|
||||
&self,
|
||||
extension: &str,
|
||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
||||
fn get_asset_loader(&self, extension: &str) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||
let index = {
|
||||
// scope map to drop lock as soon as possible
|
||||
let map = self.server.extension_to_loader_index.read();
|
||||
|
@ -149,7 +146,7 @@ impl AssetServer {
|
|||
fn get_path_asset_loader<P: AsRef<Path>>(
|
||||
&self,
|
||||
path: P,
|
||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
||||
) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||
let s = path
|
||||
.as_ref()
|
||||
.file_name()
|
||||
|
|
|
@ -631,39 +631,37 @@ pub fn queue_meshes(
|
|||
},
|
||||
BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: BindingResource::TextureView(
|
||||
&base_color_texture_view,
|
||||
),
|
||||
resource: BindingResource::TextureView(base_color_texture_view),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 2,
|
||||
resource: BindingResource::Sampler(&base_color_sampler),
|
||||
resource: BindingResource::Sampler(base_color_sampler),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 3,
|
||||
resource: BindingResource::TextureView(&emissive_texture_view),
|
||||
resource: BindingResource::TextureView(emissive_texture_view),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 4,
|
||||
resource: BindingResource::Sampler(&emissive_sampler),
|
||||
resource: BindingResource::Sampler(emissive_sampler),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 5,
|
||||
resource: BindingResource::TextureView(
|
||||
&metallic_roughness_texture_view,
|
||||
metallic_roughness_texture_view,
|
||||
),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 6,
|
||||
resource: BindingResource::Sampler(&metallic_roughness_sampler),
|
||||
resource: BindingResource::Sampler(metallic_roughness_sampler),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 7,
|
||||
resource: BindingResource::TextureView(&occlusion_texture_view),
|
||||
resource: BindingResource::TextureView(occlusion_texture_view),
|
||||
},
|
||||
BindGroupEntry {
|
||||
binding: 8,
|
||||
resource: BindingResource::Sampler(&occlusion_sampler),
|
||||
resource: BindingResource::Sampler(occlusion_sampler),
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
|
|
|
@ -210,34 +210,34 @@ impl Mesh {
|
|||
for (_, attributes) in self.attributes.iter_mut() {
|
||||
let indices = indices.iter();
|
||||
match attributes {
|
||||
VertexAttributeValues::Float32(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint32(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint32(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Float32x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint32x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint32x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Float32x3(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint32x3(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint32x3(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint32x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint32x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Float32x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint16x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Snorm16x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint16x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Unorm16x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint16x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Snorm16x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint16x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Unorm16x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint8x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Snorm8x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint8x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Unorm8x2(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Sint8x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Snorm8x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Uint8x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Unorm8x4(vec) => *vec = duplicate(&vec, indices),
|
||||
VertexAttributeValues::Float32(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint32(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint32(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Float32x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint32x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint32x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Float32x3(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint32x3(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint32x3(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint32x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint32x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Float32x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint16x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Snorm16x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint16x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Unorm16x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint16x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Snorm16x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint16x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Unorm16x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint8x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Snorm8x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint8x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Unorm8x2(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Sint8x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Snorm8x4(vec) => *vec = duplicate(vec, indices),
|
||||
VertexAttributeValues::Uint8x4(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 {
|
||||
buffer: render_device.create_buffer_with_data(&BufferInitDescriptor {
|
||||
usage: BufferUsage::INDEX,
|
||||
contents: &data,
|
||||
contents: data,
|
||||
label: None,
|
||||
}),
|
||||
count: mesh.indices().unwrap().len() as u32,
|
||||
|
|
|
@ -37,7 +37,7 @@ pub async fn initialize_renderer(
|
|||
let instance = wgpu::Instance::new(backends);
|
||||
|
||||
let adapter = instance
|
||||
.request_adapter(&request_adapter_options)
|
||||
.request_adapter(request_adapter_options)
|
||||
.await
|
||||
.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 (device, queue) = adapter
|
||||
.request_device(&device_descriptor, trace_path)
|
||||
.request_device(device_descriptor, trace_path)
|
||||
.await
|
||||
.unwrap();
|
||||
let device = Arc::new(device);
|
||||
|
|
|
@ -66,13 +66,13 @@ impl Shader {
|
|||
pub fn reflect(&self) -> Result<ShaderReflection, ShaderReflectError> {
|
||||
let module = match &self {
|
||||
// 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) => {
|
||||
let mut entry_points = HashMap::default();
|
||||
entry_points.insert("vertex".to_string(), ShaderStage::Vertex);
|
||||
entry_points.insert("fragment".to_string(), ShaderStage::Fragment);
|
||||
naga::front::glsl::parse_str(
|
||||
&source,
|
||||
source,
|
||||
&naga::front::glsl::Options {
|
||||
entry_points,
|
||||
defines: Default::default(),
|
||||
|
@ -80,7 +80,7 @@ impl Shader {
|
|||
)?
|
||||
}
|
||||
Shader::SpirV(source) => naga::front::spv::parse_u8_slice(
|
||||
&source,
|
||||
source,
|
||||
&naga::front::spv::Options {
|
||||
adjust_coordinate_space: false,
|
||||
..naga::front::spv::Options::default()
|
||||
|
|
|
@ -89,7 +89,7 @@ impl Image {
|
|||
);
|
||||
|
||||
for current_pixel in value.data.chunks_exact_mut(pixel.len()) {
|
||||
current_pixel.copy_from_slice(&pixel);
|
||||
current_pixel.copy_from_slice(pixel);
|
||||
}
|
||||
value
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue