1# Copyright 2019 The Amber 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#     https://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.
14
15[vertex shader]
16#version 430
17
18layout(location = 0) in vec4 position;
19layout(location = 0) out vec4 frag_color;
20
21void main() {
22  const vec4 color[4] =
23    { vec4(1.,0.,0.,1.),
24      vec4(0.,1.,0.,1.),
25      vec4(0.,0.,1.,1.),
26      vec4(1.,0.,1.,1.)};
27
28  const vec4 pos[4] =
29    { vec4(0. ,0. ,0. ,0. ),
30      vec4(0. ,1. ,0. ,0.),
31      vec4(1., 0., 0., 0),
32      vec4(1. ,1.,0., 0.)};
33
34  gl_Position = position + pos[gl_InstanceIndex % 4];
35  frag_color = color[gl_InstanceIndex % 4];
36}
37
38[fragment shader]
39#version 430
40
41layout(location = 0) in vec4 frag_color;
42layout(location = 0) out vec4 final_color;
43
44void main() {
45  final_color = frag_color;
46}
47
48[vertex data]
49#        position
50     0/R8G8_SNORM
51
52#   Quarter frame
53#         R8   G8
54        -128  -128
55           0  -128
56           0     0
57
58        -128   -128
59        -128      0
60           0      0
61
62[test]
63clear
64
65draw arrays instanced TRIANGLE_LIST 0 6 4
66relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0, 1.0)
67relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0.0, 0.0, 1.0, 1.0)
68relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
69relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (1.0, 0.0, 1.0, 1.0)
70