Skip to content

Commit

Permalink
Clear up some warning. Add shader compilation notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchmindtree committed Feb 18, 2020
1 parent 040e976 commit 20be540
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ where
/// If you wish to remain cross-platform frienly, we recommend that you call this on the main
/// thread as some platforms require that their application event loop and windows are
/// initialised on the main thread.
pub fn run(mut self) {
pub fn run(self) {
// Start the winit window event loop.
let event_loop = winit::event_loop::EventLoop::new();

Expand Down Expand Up @@ -447,7 +447,7 @@ where
if loop_mode != LoopMode::default() {
let present_mode = window::preferred_present_mode(&loop_mode);
let mut windows = app.windows.borrow_mut();
for window in windows.values_mut() {
for _window in windows.values_mut() {
// TODO: Update window for loop/present mode.
}
}
Expand Down Expand Up @@ -772,7 +772,6 @@ impl App {
Some(window) => window,
};

let texture_format = crate::frame::Frame::TEXTURE_FORMAT;
let draw = self.draw_state.draw.borrow_mut();
draw.reset();

Expand All @@ -785,7 +784,7 @@ impl App {
let renderer = draw::backend::wgpu::Renderer::new(
device,
msaa_samples,
texture_format,
target_format,
);
RefCell::new(renderer)
})
Expand Down
4 changes: 2 additions & 2 deletions src/draw/backend/wgpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ impl Renderer {
render_pass.set_bind_group(0, bind_group, &[]);
render_pass.set_index_buffer(&index_buffer, 0);
render_pass.set_vertex_buffers(0, &[(&vertex_buffer, 0)]);
let vertex_range = 0..vertices.len() as u32;
let index_range = 0..indices.len() as u32;
let start_vertex = 0;
let instance_range = 0..1;
render_pass.draw_indexed(index_range, 0, instance_range);
render_pass.draw_indexed(index_range, start_vertex, instance_range);
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/draw/backend/wgpu/shaders/shader.frag
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// NOTE: This shader requires being manually compiled to SPIR-V in order to
// avoid having downstream users require building shaderc and compiling the
// shader themselves. If you update this shader, be sure to also re-compile it
// and update `frag.spv`. You can do so using `glslangValidator` with the
// following command: `glslangValidator -V -o frag.spv shader.frag`

#version 450

layout(location = 0) in vec4 v_color;
Expand Down
6 changes: 6 additions & 0 deletions src/draw/backend/wgpu/shaders/shader.vert
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// NOTE: This shader requires being manually compiled to SPIR-V in order to
// avoid having downstream users require building shaderc and compiling the
// shader themselves. If you update this shader, be sure to also re-compile it
// and update `vert.spv`. You can do so using `glslangValidator` with the
// following command: `glslangValidator -V -o vert.spv shader.vert`

#version 450

layout(location = 0) in vec3 position;
Expand Down
1 change: 0 additions & 1 deletion src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use crate::wgpu;
use crate::App;
use std::any::Any;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use std::{env, fmt};
use winit::dpi::LogicalSize;
Expand Down

0 comments on commit 20be540

Please sign in to comment.