Skip to content

Commit

Permalink
debug: Increase number of vertices so it is easier to spot whether th…
Browse files Browse the repository at this point in the history
…ey were rendered
  • Loading branch information
REASY committed Feb 3, 2023
1 parent 733899b commit 26faf4e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
2 changes: 1 addition & 1 deletion wgpu/examples/hello-triangle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
depth_stencil_attachment: None,
});
rpass.set_pipeline(&render_pipeline);
rpass.draw(0..3, 0..1);
rpass.draw(0..64, 0..1);
}

queue.submit(Some(encoder.finish()));
Expand Down
70 changes: 67 additions & 3 deletions wgpu/examples/hello-triangle/shader.wgsl
Original file line number Diff line number Diff line change
@@ -1,8 +1,72 @@
@vertex
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> {
let x = f32(i32(in_vertex_index) - 1);
let y = f32(i32(in_vertex_index & 1u) * 2 - 1);
return vec4<f32>(x, y, 0.0, 1.0);
var pos = array<vec2<f32>,64>(
vec2<f32>(0.5, 0.7),
vec2<f32>(0.51, 0.7),
vec2<f32>(0.52, 0.7),
vec2<f32>(0.53, 0.7),
vec2<f32>(0.54, 0.7),
vec2<f32>(0.55, 0.7),
vec2<f32>(0.56, 0.7),
vec2<f32>(0.57, 0.7),
vec2<f32>(0.6, 0.7),
vec2<f32>(0.61, 0.7),
vec2<f32>(0.62, 0.7),
vec2<f32>(0.63, 0.7),
vec2<f32>(0.64, 0.7),
vec2<f32>(0.65, 0.7),
vec2<f32>(0.66, 0.7),
vec2<f32>(0.67, 0.7),
vec2<f32>(0.7, 0.7),
vec2<f32>(0.71, 0.7),
vec2<f32>(0.72, 0.7),
vec2<f32>(0.73, 0.7),
vec2<f32>(0.74, 0.7),
vec2<f32>(0.75, 0.7),
vec2<f32>(0.76, 0.7),
vec2<f32>(0.77, 0.7),
vec2<f32>(0.8, 0.7),
vec2<f32>(0.81, 0.7),
vec2<f32>(0.82, 0.7),
vec2<f32>(0.83, 0.7),
vec2<f32>(0.84, 0.7),
vec2<f32>(0.85, 0.7),
vec2<f32>(0.86, 0.7),
vec2<f32>(0.87, 0.7),
vec2<f32>(0.5, 0.72),
vec2<f32>(0.51, 0.72),
vec2<f32>(0.52, 0.72),
vec2<f32>(0.53, 0.72),
vec2<f32>(0.54, 0.72),
vec2<f32>(0.55, 0.72),
vec2<f32>(0.56, 0.72),
vec2<f32>(0.57, 0.72),
vec2<f32>(0.6, 0.74),
vec2<f32>(0.61, 0.74),
vec2<f32>(0.62, 0.74),
vec2<f32>(0.63, 0.74),
vec2<f32>(0.64, 0.74),
vec2<f32>(0.65, 0.74),
vec2<f32>(0.66, 0.74),
vec2<f32>(0.67, 0.74),
vec2<f32>(0.7, 0.76),
vec2<f32>(0.71, 0.76),
vec2<f32>(0.72, 0.76),
vec2<f32>(0.73, 0.76),
vec2<f32>(0.74, 0.76),
vec2<f32>(0.75, 0.76),
vec2<f32>(0.76, 0.76),
vec2<f32>(0.77, 0.76),
vec2<f32>(0.8, 0.78),
vec2<f32>(0.81, 0.78),
vec2<f32>(0.82, 0.78),
vec2<f32>(0.83, 0.78),
vec2<f32>(0.84, 0.78),
vec2<f32>(0.85, 0.78),
vec2<f32>(0.86, 0.78),
vec2<f32>(0.87, 0.78),
);
return vec4<f32>(pos[in_vertex_index], 0.0, 1.0);
}

@fragment
Expand Down

0 comments on commit 26faf4e

Please sign in to comment.