dan sinclair | 42e873c | 2021-01-12 18:13:28 +0000 | [diff] [blame] | 1 | // Copyright 2020 The Tint Authors. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 14 | |
dan sinclair | 42e873c | 2021-01-12 18:13:28 +0000 | [diff] [blame] | 15 | // Vertex shader |
Ben Clayton | c64ca23 | 2022-06-29 00:55:36 +0000 | [diff] [blame] | 16 | const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5), |
| 17 | vec2(-0.5, -0.5), |
| 18 | vec2(0.5, -0.5)); |
Ben Clayton | 3cbb136 | 2022-01-06 18:11:01 +0000 | [diff] [blame] | 19 | |
dan sinclair | b29892b | 2022-06-07 13:55:34 +0000 | [diff] [blame] | 20 | @vertex |
Ben Clayton | 01e4b6f | 2022-01-19 22:46:57 +0000 | [diff] [blame] | 21 | fn vtx_main(@builtin(vertex_index) VertexIndex : u32) |
| 22 | -> @builtin(position) vec4<f32> { |
James Price | a2239c6 | 2021-04-06 18:08:47 +0000 | [diff] [blame] | 23 | return vec4<f32>(pos[VertexIndex], 0.0, 1.0); |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 24 | } |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 25 | |
dan sinclair | 42e873c | 2021-01-12 18:13:28 +0000 | [diff] [blame] | 26 | // Fragment shader |
dan sinclair | b29892b | 2022-06-07 13:55:34 +0000 | [diff] [blame] | 27 | @fragment |
Ben Clayton | 01e4b6f | 2022-01-19 22:46:57 +0000 | [diff] [blame] | 28 | fn frag_main() -> @location(0) vec4<f32> { |
James Price | a2239c6 | 2021-04-06 18:08:47 +0000 | [diff] [blame] | 29 | return vec4<f32>(1.0, 0.0, 0.0, 1.0); |
Dan Sinclair | 6e58189 | 2020-03-02 15:47:43 -0500 | [diff] [blame] | 30 | } |