• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 rect -1 -1 1 1
89
90ssbo 0 subdata vec4 0 0.0 1.0 0.0 1.0
91draw rect -1  0 1 1
92
93ssbo 0 subdata vec4 0 0.0 0.0 1.0 1.0
94draw rect  0 -1 1 1
95
96ssbo 0 subdata vec4 0 0.5 0.0 0.5 1.0
97draw rect  0  0 1 1
98
99relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (1.0,   0,   0, 1.0)
100relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (  0, 1.0,   0, 1.0)
101relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (  0,   0, 1.0, 1.0)
102relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.5,   0, 0.5, 1.0)
103
104ssbo 0 subdata vec4 0 1.0 0.0 0.0 1.0
105draw arrays TRIANGLE_LIST 0 6
106relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0)
107
108ssbo 0 subdata vec4 0 0.0 1.0 0.0 1.0
109draw arrays TRIANGLE_LIST 6 6
110relative probe rect rgb (0.0, 0.0, 0.5, 1.0) (1.0, 0, 0)
111relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0)
112
113ssbo 0 subdata vec4 0 0.0 0.0 1.0 1.0
114draw arrays TRIANGLE_LIST 12 6
115relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0)
116relative probe rect rgb (0.5, 0.0, 0.5, 1.0) (0, 1.0, 0)
117relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0)
118
119ssbo 0 subdata vec4 0 0.5 0.5 0.5 1.0
120draw arrays TRIANGLE_LIST 18 6
121relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0, 0)
122relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0, 1.0, 0)
123relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0, 0, 1.0)
124relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (0.5, 0.5, 0.5)
125