struct VsOut {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
};
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VsOut {
var positions = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0),
vec2<f32>(3.0, -1.0),
vec2<f32>(-1.0, 3.0),
);
var out: VsOut;
let position = positions[vertex_index];
out.position = vec4<f32>(position, 0.0, 1.0);
out.uv = position * 0.5 + vec2<f32>(0.5, 0.5);
return out;
}
@fragment
fn fs_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
return vec4<f32>(0.08 + uv.x * 0.2, 0.1 + uv.y * 0.25, 0.16, 1.0);
}