shaderexp: use one triangle for fullscreen
This commit is contained in:
parent
c57f0575ea
commit
d9f10d25d0
2 changed files with 15 additions and 21 deletions
|
|
@ -139,7 +139,7 @@ pub fn update(app: *App, core: *mach.Core) !void {
|
||||||
const pass = encoder.beginRenderPass(&render_pass_info);
|
const pass = encoder.beginRenderPass(&render_pass_info);
|
||||||
pass.setPipeline(app.pipeline);
|
pass.setPipeline(app.pipeline);
|
||||||
pass.setBindGroup(0, app.bind_group, &.{0});
|
pass.setBindGroup(0, app.bind_group, &.{0});
|
||||||
pass.draw(6, 1, 0, 0);
|
pass.draw(3, 1, 0, 0);
|
||||||
pass.end();
|
pass.end();
|
||||||
pass.release();
|
pass.release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,23 @@
|
||||||
struct VertexOut {
|
struct VertexOut {
|
||||||
@builtin(position) position_clip : vec4<f32>,
|
@builtin(position) position_clip : vec4<f32>,
|
||||||
@location(0) frag_uv : vec2<f32>,
|
@location(0) frag_uv : vec2<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@vertex fn main(@builtin(vertex_index) index : u32) -> 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>( 3.0, -1.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
vec2<f32>(-1.0, 3.0),
|
||||||
vec2<f32>( 1.0, 1.0),
|
|
||||||
vec2<f32>(-1.0, 1.0),
|
|
||||||
vec2<f32>(-1.0, -1.0)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var uv = array<vec2<f32>, 6>(
|
var uv = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(0.0, 0.0),
|
vec2<f32>(0.0, 0.0),
|
||||||
vec2<f32>(1.0, 0.0),
|
vec2<f32>(2.0, 0.0),
|
||||||
vec2<f32>(1.0, 1.0),
|
vec2<f32>(0.0, 2.0),
|
||||||
vec2<f32>(1.0, 1.0),
|
|
||||||
vec2<f32>(0.0, 1.0),
|
|
||||||
vec2<f32>(0.0, 0.0)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var output : VertexOut;
|
var output : VertexOut;
|
||||||
output.position_clip = vec4<f32>(pos[index], 0.0, 1.0);
|
output.position_clip = vec4<f32>(pos[index], 0.0, 1.0);
|
||||||
output.frag_uv = uv[index];
|
output.frag_uv = uv[index];
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue