diff options
| author | Micha White <botahamec@outlook.com> | 2022-09-18 14:49:16 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-09-18 14:49:16 -0400 |
| commit | ffee09ada476b3a350f331718d60fa806b564bad (patch) | |
| tree | d2998f5bc6deea7e8cd746ce08c94b78764c58b7 /shaders | |
| parent | b92e827eb623a8d93872c6f95aceeb882b867a29 (diff) | |
Made a square
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/sprite.wgsl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shaders/sprite.wgsl b/shaders/sprite.wgsl new file mode 100644 index 0000000..7d2c5ce --- /dev/null +++ b/shaders/sprite.wgsl @@ -0,0 +1,18 @@ + +struct VertexOutput { + @builtin(position) clip_position: vec4<f32> +} + +@vertex +fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> VertexOutput { + var out: VertexOutput; + let x = (1.0 * f32(in_vertex_index % u32(2))) + -0.5; + let y = (1.0 * f32(in_vertex_index / u32(2))) + -0.5; + out.clip_position = vec4<f32>(x, y, 0.0, 1.0); + return out; +} + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { + return vec4<f32>(1.0, 1.0, 1.0, 0.0); +}
\ No newline at end of file |
