mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
17 lines
441 B
WebGPU Shading Language
17 lines
441 B
WebGPU Shading Language
@vertex
|
|
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<f32> {
|
|
// hacky way to draw a large triangle
|
|
let tmp1 = i32(vertex_index) / 2;
|
|
let tmp2 = i32(vertex_index) & 1;
|
|
let pos = vec2<f32>(
|
|
f32(tmp1) * 4.0 - 1.0,
|
|
f32(tmp2) * 4.0 - 1.0
|
|
);
|
|
return vec4<f32>(pos, 0.0, 1.0);
|
|
}
|
|
|
|
@fragment
|
|
fn fs_main() -> @location(0) vec4<f32> {
|
|
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
|
}
|