rust-game-engine/shaders/shader.wgsl

26 lines
460 B
WebGPU Shading Language
Raw Normal View History

2023-09-27 22:29:29 +02:00
2023-09-15 19:37:35 +02:00
@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);
2023-09-27 22:29:29 +02:00
// param 0
// x = -1
// y = -1
// param 1
// x = 0
// y = 1
// param 2
// x = 1
// y = -1
2023-09-15 19:37:35 +02:00
}
@fragment
fn fs_main() -> @location(0) vec4<f32> {
2023-09-27 22:29:29 +02:00
return vec4<f32>(0.0, 0.0, 1.0, 1.0);
2023-09-15 19:37:35 +02:00
}