• 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[require]
16vertexPipelineStoresAndAtomics
17
18[vertex shader]
19#version 430
20
21layout(location = 0) in vec4 position;
22layout(location = 1) in vec4 vert_color;
23layout(location = 0) out vec4 frag_color;
24
25layout(set = 0, binding = 0) uniform block0 {
26  vec4 ubo_addon0;
27  vec4 ubo_addon1;
28};
29
30layout(set = 1, binding = 0) uniform block1 {
31  float ubo_data_set1_binding0[11];
32};
33
34layout(set = 1, binding = 2) buffer block2 {
35  float ssbo_data_set1_binding2[11];
36};
37
38layout(set = 2, binding = 1) uniform block3 {
39  float ubo_data_set2_binding1[11];
40};
41
42layout(set = 2, binding = 3) buffer block4 {
43  float ssbo_data_set2_binding3[11];
44};
45
46void main() {
47  gl_Position = position;
48  frag_color = vert_color + (ubo_addon0 + ubo_addon1) / 2.0f;
49
50  for (int i = 0; i < 11; ++i) {
51    ssbo_data_set1_binding2[i] = ubo_data_set2_binding1[i];
52    ssbo_data_set2_binding3[i] = ubo_data_set1_binding0[i];
53  }
54}
55
56[fragment shader]
57#version 430
58
59layout(location = 0) in vec4 frag_color;
60layout(location = 0) out vec4 final_color;
61
62void main() {
63  final_color = frag_color;
64}
65
66[vertex data]
67#      position                   vert_color
680/R32G32_SFLOAT        1/R32G32B32A32_SFLOAT
69
70#      R32  G32         R32   G32    B32 B32
71      -1.0 -1.0         0.5  0.25  0.125   0
72       1.0  1.0         0.5  0.25  0.125   0
73      -1.0  1.0         0.5  0.25  0.125   0
74
75      -1.0 -1.0         0.5  0.25  0.125   0
76       1.0  1.0         0.5  0.25  0.125   0
77       1.0 -1.0         0.5  0.25  0.125   0
78
79[test]
80clear
81
82uniform ubo 0:0 vec4  0 0.1 0.2 0.3 0.4
83uniform ubo 0:0 vec4 16 0.9 0.8 0.7 0.6
84
85uniform ubo 1:0 float 0 0.1  0 0 0 \
86                        0.2  0 0 0 \
87                        0.3  0 0 0 \
88                        0.4  0 0 0 \
89                        0.5  0 0 0 \
90                        0.6  0 0 0 \
91                        0.7  0 0 0 \
92                        0.8  0 0 0 \
93                        0.9  0 0 0 \
94                        0.10 0 0 0 \
95                        0.11 0 0 0
96
97ssbo 1:2 subdata float 0 0.1 0.2  0.3  0.4 \
98                         0.5 0.6  0.7  0.8 \
99                         0.9 0.10 0.11
100
101uniform ubo 2:1 float 0 0.1  0 0 0 \
102                        0.2  0 0 0 \
103                        0.3  0 0 0 \
104                        0.4  0 0 0 \
105                        0.5  0 0 0 \
106                        0.6  0 0 0 \
107                        0.7  0 0 0 \
108                        0.8  0 0 0 \
109                        0.9  0 0 0 \
110                        0.10 0 0 0 \
111                        0.11 0 0 0
112
113ssbo 2:3 subdata float 0 0.1 0.2  0.3  0.4 \
114                         0.5 0.6  0.7  0.8 \
115                         0.9 0.10 0.11
116
117draw arrays TRIANGLE_LIST 0 6
118relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0.75, 0.625, 0.5)
119
120uniform ubo 0:0 vec4 0 0.5 0.5 0.25 1.0 \
121                       0.3 0.2 0.1  0.4
122
123ssbo 1:2 subdata float 0 0.57 0.56 0.55 0.54 \
124                         0.53 0.52 0.51 0.50 \
125                         0.49 0.48 0.47
126
127uniform ubo 2:1 float 0 0.21 0 0 0 \
128                        0.22 0 0 0 \
129                        0.23 0 0 0 \
130                        0.24 0 0 0 \
131                        0.25 0 0 0 \
132                        0.26 0 0 0 \
133                        0.27 0 0 0 \
134                        0.28 0 0 0 \
135                        0.29 0 0 0 \
136                        0.30 0 0 0 \
137                        0.31 0 0 0
138
139ssbo 2:3 subdata float 0 0.23  0.229 0.228 0.227 \
140                         0.226 0.225 0.224 0.223 \
141                         0.222 0.221 0.22
142
143draw arrays TRIANGLE_LIST 0 6
144relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.9, 0.6, 0.3, 0.7)
145
146probe ssbo float 1:2 0  ~= 0.21 0.22 0.23 0.24 \
147                           0.25 0.26 0.27 0.28 \
148                           0.29 0.30 0.31
149probe ssbo float 2:3 0  ~= 0.1 0.2  0.3  0.4 \
150                           0.5 0.6  0.7  0.8 \
151                           0.9 0.10 0.11
152
153uniform ubo 0:0 vec4  0  0.5 0.5 0.35 0.6 \
154                         0.1 0.4 0.1  0.4
155
156draw arrays TRIANGLE_LIST 0 6
157relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.8, 0.7, 0.35, 0.5)
158