mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
17 lines
470 B
WebGPU Shading Language
17 lines
470 B
WebGPU Shading Language
[[stage(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);
|
|
}
|
|
|
|
[[stage(fragment)]]
|
|
fn fs_main() -> [[location(0)]] vec4<f32> {
|
|
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
|
}
|