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