shaderexp: use one triangle for fullscreen

This commit is contained in:
praschke 2022-08-22 13:30:14 +00:00 committed by Stephen Gutekanst
parent c57f0575ea
commit d9f10d25d0
2 changed files with 15 additions and 21 deletions

View file

@ -139,7 +139,7 @@ pub fn update(app: *App, core: *mach.Core) !void {
const pass = encoder.beginRenderPass(&render_pass_info);
pass.setPipeline(app.pipeline);
pass.setBindGroup(0, app.bind_group, &.{0});
pass.draw(6, 1, 0, 0);
pass.draw(3, 1, 0, 0);
pass.end();
pass.release();

View file

@ -4,22 +4,16 @@ struct VertexOut {
}
@vertex fn main(@builtin(vertex_index) index : u32) -> VertexOut {
var pos = array<vec2<f32>, 6>(
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 1.0, -1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>( 1.0, 1.0),
vec2<f32>(-1.0, 1.0),
vec2<f32>(-1.0, -1.0)
vec2<f32>( 3.0, -1.0),
vec2<f32>(-1.0, 3.0),
);
var uv = array<vec2<f32>, 6>(
var uv = array<vec2<f32>, 3>(
vec2<f32>(0.0, 0.0),
vec2<f32>(1.0, 0.0),
vec2<f32>(1.0, 1.0),
vec2<f32>(1.0, 1.0),
vec2<f32>(0.0, 1.0),
vec2<f32>(0.0, 0.0)
vec2<f32>(2.0, 0.0),
vec2<f32>(0.0, 2.0),
);
var output : VertexOut;