[CLEANUP] Remove useless comment
This commit is contained in:
parent
1feca362a7
commit
131123842c
2 changed files with 0 additions and 18 deletions
13
src/lib.rs
13
src/lib.rs
|
@ -70,20 +70,13 @@ impl model::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: &[
|
||||||
wgpu::VertexAttribute {
|
wgpu::VertexAttribute {
|
||||||
offset: 0,
|
offset: 0,
|
||||||
// While our vertex shader only uses locations 0, and 1 now, in later tutorials we'll
|
|
||||||
// be using 2, 3, and 4, for Vertex. We'll start at slot 5 not conflict with them later
|
|
||||||
shader_location: 5,
|
shader_location: 5,
|
||||||
format: wgpu::VertexFormat::Float32x4,
|
format: wgpu::VertexFormat::Float32x4,
|
||||||
},
|
},
|
||||||
// A mat4 takes up 4 vertex slots as it is technically 4 vec4s. We need to define a slot
|
|
||||||
// for each vec4. We don't have to do this in code though.
|
|
||||||
wgpu::VertexAttribute {
|
wgpu::VertexAttribute {
|
||||||
offset: mem::size_of::<[f32; 4]>() as wgpu::BufferAddress,
|
offset: mem::size_of::<[f32; 4]>() as wgpu::BufferAddress,
|
||||||
shader_location: 6,
|
shader_location: 6,
|
||||||
|
@ -123,7 +116,6 @@ impl model::Vertex for InstanceRaw {
|
||||||
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
|
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
|
||||||
struct LightUniform {
|
struct LightUniform {
|
||||||
position: [f32; 3],
|
position: [f32; 3],
|
||||||
// Due to uniforms requiring 16 byte (4 float) spacing, we need to use a padding field here
|
|
||||||
_padding: u32,
|
_padding: u32,
|
||||||
color: [f32; 3],
|
color: [f32; 3],
|
||||||
_padding2: u32,
|
_padding2: u32,
|
||||||
|
@ -149,8 +141,6 @@ pub async fn run() {
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
{
|
||||||
// Winit prevents sizing with CSS, so we have to set
|
|
||||||
// the size manually when on web.
|
|
||||||
use winit::dpi::PhysicalSize;
|
use winit::dpi::PhysicalSize;
|
||||||
window.set_inner_size(PhysicalSize::new(450, 400));
|
window.set_inner_size(PhysicalSize::new(450, 400));
|
||||||
|
|
||||||
|
@ -210,13 +200,10 @@ pub async fn run() {
|
||||||
renderer.update(dt);
|
renderer.update(dt);
|
||||||
match renderer.render() {
|
match renderer.render() {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
// Reconfigure the surface if it's lost or outdated
|
|
||||||
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
|
Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => {
|
||||||
renderer.resize(renderer.size)
|
renderer.resize(renderer.size)
|
||||||
}
|
}
|
||||||
// The system is out of memory, we should probably quit
|
|
||||||
Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit,
|
Err(wgpu::SurfaceError::OutOfMemory) => *control_flow = ControlFlow::Exit,
|
||||||
// We're ignoring timeouts
|
|
||||||
Err(wgpu::SurfaceError::Timeout) => log::warn!("Surface timeout"),
|
Err(wgpu::SurfaceError::Timeout) => log::warn!("Surface timeout"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,8 @@ pub fn create_render_pipeline(
|
||||||
strip_index_format: None,
|
strip_index_format: None,
|
||||||
front_face: wgpu::FrontFace::Ccw,
|
front_face: wgpu::FrontFace::Ccw,
|
||||||
cull_mode: Some(wgpu::Face::Back),
|
cull_mode: Some(wgpu::Face::Back),
|
||||||
// Setting this to anything other than Fill requires Features::NON_FILL_POLYGON_MODE
|
|
||||||
polygon_mode: wgpu::PolygonMode::Fill,
|
polygon_mode: wgpu::PolygonMode::Fill,
|
||||||
// Requires Features::DEPTH_CLIP_CONTROL
|
|
||||||
unclipped_depth: false,
|
unclipped_depth: false,
|
||||||
// Requires Features::CONSERVATIVE_RASTERIZATION
|
|
||||||
conservative: false,
|
conservative: false,
|
||||||
},
|
},
|
||||||
depth_stencil: depth_format.map(|format| wgpu::DepthStencilState {
|
depth_stencil: depth_format.map(|format| wgpu::DepthStencilState {
|
||||||
|
@ -52,8 +49,6 @@ pub fn create_render_pipeline(
|
||||||
mask: !0,
|
mask: !0,
|
||||||
alpha_to_coverage_enabled: false,
|
alpha_to_coverage_enabled: false,
|
||||||
},
|
},
|
||||||
// If the pipeline will be used with a multiview render pass, this
|
|
||||||
// indicates how many array layers the attachments will have.
|
|
||||||
multiview: None,
|
multiview: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue