1# Copyright 2018 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
21layout(set = 0, binding = 0) readonly buffer block1 {
22  vec4 in_color;
23};
24
25void main() {
26  gl_Position = position;
27  frag_color = in_color;
28}
29
30[fragment shader]
31#version 430
32
33layout(location = 0) in vec4 frag_color;
34layout(location = 0) out vec4 final_color;
35
36void main() {
37  final_color = frag_color;
38}
39
40[vertex data]
41#        position
42     0/R8G8_SNORM
43
44#    Entire frame
45#         R8   G8
46        -128 -128
47         127  127
48        -128  127
49
50        -128 -128
51         127  127
52         127 -128
53
54#      Half frame
55#         R8   G8
56           0 -128
57         127  127
58           0  127
59
60           0 -128
61         127  127
62         127 -128
63
64#   Quarter frame
65#         R8   G8
66        -128    0
67           0  127
68        -128  127
69
70        -128    0
71           0  127
72           0    0
73
74#   Quarter frame
75#         R8   G8
76           0    0
77         127  127
78           0  127
79
80           0    0
81         127  127
82         127    0
83
84[test]
85clear
86
87ssbo 0 subdata vec4 0 1.0 0.0 0.0 1.0
88draw arrays TRIANGLE_LIST 0 6
89relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0)
90
91ssbo 0 subdata vec4 0 0.0 1.0 0.0 1.0
92draw arrays TRIANGLE_LIST 6 6
93relative probe rect rgb (0.0, 0.0, 0.5, 1.0) (1.0, 0, 0)
94relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0)
95
96ssbo 0 subdata vec4 0 0.0 0.0 1.0 1.0
97draw arrays TRIANGLE_LIST 12 6
98relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0)
99relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0)
100relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0)
101
102ssbo 0 subdata vec4 0 0.5 0.5 0.5 1.0
103draw arrays TRIANGLE_LIST 18 6
104relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0)
105relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0)
106relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0)
107relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5)
108
109ssbo 0 subdata vec4 0 1.0 0.0 0.0 1.0
110draw rect -1 -1 1 1
111
112ssbo 0 subdata vec4 0 0.0 1.0 0.0 1.0
113draw rect -1  0 1 1
114
115ssbo 0 subdata vec4 0 0.0 0.0 1.0 1.0
116draw rect  0 -1 1 1
117
118ssbo 0 subdata vec4 0 0.5 0.0 0.5 1.0
119draw rect  0  0 1 1
120
121relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0,   0,   0, 1.0)
122relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (  0, 1.0,   0, 1.0)
123relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (  0,   0, 1.0, 1.0)
124relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5,   0, 0.5, 1.0)
125