blob: 814c1c0be991d94ca973067a700c392f119fb5b1 [file] [log] [blame]
dan sinclair42e873c2021-01-12 18:13:28 +00001// 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 Sinclair6e581892020-03-02 15:47:43 -050014
dan sinclair42e873c2021-01-12 18:13:28 +000015// Vertex shader
Ben Claytonc64ca232022-06-29 00:55:36 +000016const pos = array<vec2<f32>, 3>(vec2(0.0, 0.5),
17 vec2(-0.5, -0.5),
18 vec2(0.5, -0.5));
Ben Clayton3cbb1362022-01-06 18:11:01 +000019
dan sinclairb29892b2022-06-07 13:55:34 +000020@vertex
Ben Clayton01e4b6f2022-01-19 22:46:57 +000021fn vtx_main(@builtin(vertex_index) VertexIndex : u32)
22 -> @builtin(position) vec4<f32> {
James Pricea2239c62021-04-06 18:08:47 +000023 return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
Dan Sinclair6e581892020-03-02 15:47:43 -050024}
Dan Sinclair6e581892020-03-02 15:47:43 -050025
dan sinclair42e873c2021-01-12 18:13:28 +000026// Fragment shader
dan sinclairb29892b2022-06-07 13:55:34 +000027@fragment
Ben Clayton01e4b6f2022-01-19 22:46:57 +000028fn frag_main() -> @location(0) vec4<f32> {
James Pricea2239c62021-04-06 18:08:47 +000029 return vec4<f32>(1.0, 0.0, 0.0, 1.0);
Dan Sinclair6e581892020-03-02 15:47:43 -050030}