Clippy fixes
This commit is contained in:
parent
ebef7fe1c5
commit
2dc20ad12c
6 changed files with 9 additions and 13 deletions
|
@ -28,9 +28,6 @@ impl Vertex for InstanceRaw {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
wgpu::VertexBufferLayout {
|
wgpu::VertexBufferLayout {
|
||||||
array_stride: mem::size_of::<InstanceRaw>() as wgpu::BufferAddress,
|
array_stride: mem::size_of::<InstanceRaw>() as wgpu::BufferAddress,
|
||||||
// We need to switch from using a step mode of Vertex to Instance
|
|
||||||
// This means that our shaders will only change to use the next
|
|
||||||
// instance when the shader starts processing a new instance
|
|
||||||
step_mode: wgpu::VertexStepMode::Instance,
|
step_mode: wgpu::VertexStepMode::Instance,
|
||||||
attributes: &[
|
attributes: &[
|
||||||
// model matrix
|
// model matrix
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl LightUniform {
|
||||||
position,
|
position,
|
||||||
_padding: 0,
|
_padding: 0,
|
||||||
color,
|
color,
|
||||||
matrices: matrices,
|
matrices,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ impl RenderPass {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
let layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||||
label: Some((label.to_owned() + " pipeline Layout").as_str()),
|
label: Some((label.to_owned() + " pipeline Layout").as_str()),
|
||||||
bind_group_layouts: bind_group_layouts,
|
bind_group_layouts,
|
||||||
push_constant_ranges: push_constant_ranges,
|
push_constant_ranges,
|
||||||
});
|
});
|
||||||
let shader = wgpu::ShaderModuleDescriptor {
|
let shader = wgpu::ShaderModuleDescriptor {
|
||||||
label: Some(shader_name),
|
label: Some(shader_name),
|
||||||
|
@ -80,7 +80,7 @@ impl RenderPass {
|
||||||
entry_point: "vs_main",
|
entry_point: "vs_main",
|
||||||
buffers: vertex_layouts,
|
buffers: vertex_layouts,
|
||||||
},
|
},
|
||||||
fragment: fragment,
|
fragment,
|
||||||
primitive: wgpu::PrimitiveState {
|
primitive: wgpu::PrimitiveState {
|
||||||
topology: wgpu::PrimitiveTopology::TriangleList,
|
topology: wgpu::PrimitiveTopology::TriangleList,
|
||||||
strip_index_format: None,
|
strip_index_format: None,
|
||||||
|
|
|
@ -165,7 +165,7 @@ impl State {
|
||||||
aspect: wgpu::TextureAspect::All,
|
aspect: wgpu::TextureAspect::All,
|
||||||
base_mip_level: 0,
|
base_mip_level: 0,
|
||||||
mip_level_count: None,
|
mip_level_count: None,
|
||||||
base_array_layer: i as u32,
|
base_array_layer: i,
|
||||||
array_layer_count: Some(1),
|
array_layer_count: Some(1),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -20,8 +20,8 @@ impl Texture {
|
||||||
usage: wgpu::TextureUsages,
|
usage: wgpu::TextureUsages,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let size = wgpu::Extent3d {
|
let size = wgpu::Extent3d {
|
||||||
width: width,
|
width,
|
||||||
height: height,
|
height,
|
||||||
depth_or_array_layers: layers,
|
depth_or_array_layers: layers,
|
||||||
};
|
};
|
||||||
let desc = wgpu::TextureDescriptor {
|
let desc = wgpu::TextureDescriptor {
|
||||||
|
|
|
@ -120,15 +120,14 @@ pub async fn run() {
|
||||||
|
|
||||||
fn lock_cursor(window: &winit::window::Window, lock: bool) {
|
fn lock_cursor(window: &winit::window::Window, lock: bool) {
|
||||||
if lock {
|
if lock {
|
||||||
match window
|
if let Err(e) = window
|
||||||
.set_cursor_grab(if cfg!(target_arch = "wasm32") {
|
.set_cursor_grab(if cfg!(target_arch = "wasm32") {
|
||||||
winit::window::CursorGrabMode::Locked
|
winit::window::CursorGrabMode::Locked
|
||||||
} else {
|
} else {
|
||||||
winit::window::CursorGrabMode::Confined
|
winit::window::CursorGrabMode::Confined
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
Err(e) => println!("Failed to grab cursor {e:?}"),
|
println!("Failed to grab cursor {e:?}")
|
||||||
_ => ()
|
|
||||||
}
|
}
|
||||||
window.set_cursor_visible(false);
|
window.set_cursor_visible(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue