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

@ -1,29 +1,23 @@
struct VertexOut {
@builtin(position) position_clip : vec4<f32>,
@location(0) frag_uv : vec2<f32>,
@builtin(position) position_clip : vec4<f32>,
@location(0) frag_uv : vec2<f32>,
}
@vertex fn main(@builtin(vertex_index) index : u32) -> VertexOut {
var pos = array<vec2<f32>, 6>(
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)
var pos = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>( 3.0, -1.0),
vec2<f32>(-1.0, 3.0),
);
var uv = array<vec2<f32>, 6>(
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)
var uv = array<vec2<f32>, 3>(
vec2<f32>(0.0, 0.0),
vec2<f32>(2.0, 0.0),
vec2<f32>(0.0, 2.0),
);
var output : VertexOut;
output.position_clip = vec4<f32>(pos[index], 0.0, 1.0);
output.frag_uv = uv[index];
return output;
var output : VertexOut;
output.position_clip = vec4<f32>(pos[index], 0.0, 1.0);
output.frag_uv = uv[index];
return output;
}