aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/multiple_ssbo_update_with_graphics_pipeline.vkscript
blob: c175d05b9551bd5c083451e29563a72c863b4343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Copyright 2018 The Amber Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[require]
vertexPipelineStoresAndAtomics

[vertex shader]
#version 430

layout(location = 0) in vec4 position;
layout(location = 1) in vec4 vert_color;
layout(location = 0) out vec4 frag_color;

layout(set = 0, binding = 0) buffer block0 {
  vec4 addon0;
  vec4 addon1;
};

layout(set = 1, binding = 0) buffer block1 {
  float data_set1_binding0[11];
  float data_set1_binding0_result[11];
};

layout(set = 1, binding = 2) buffer block2 {
  float data_set1_binding2[11];
  float data_set1_binding2_result[11];
};

layout(set = 2, binding = 1) buffer block3 {
  float data_set2_binding1[11];
  float data_set2_binding1_result[11];
};

layout(set = 2, binding = 3) buffer block4 {
  float data_set2_binding3[11];
  float data_set2_binding3_result[11];
};

void main() {
  gl_Position = position;
  frag_color = vert_color + (addon0 + addon1) / 2.0f;

  for (int i = 0; i < 11; ++i) {
    data_set1_binding0_result[i] = data_set1_binding2[i];
    data_set1_binding2_result[i] = data_set2_binding1[i];
    data_set2_binding1_result[i] = data_set2_binding3[i];
    data_set2_binding3_result[i] = data_set1_binding0[i];
  }
}

[fragment shader]
#version 430

layout(location = 0) in vec4 frag_color;
layout(location = 0) out vec4 final_color;

void main() {
  final_color = frag_color;
}

[vertex data]
#      position                   vert_color
0/R32G32_SFLOAT        1/R32G32B32A32_SFLOAT

#      R32  G32         R32   G32    B32 B32
      -1.0 -1.0         0.5  0.25  0.125   0
       1.0  1.0         0.5  0.25  0.125   0
      -1.0  1.0         0.5  0.25  0.125   0

      -1.0 -1.0         0.5  0.25  0.125   0
       1.0  1.0         0.5  0.25  0.125   0
       1.0 -1.0         0.5  0.25  0.125   0

[test]
clear

# Allocate enough space for the uniform buffers including 16-byte alignment.
ssbo 1:0 96
ssbo 1:2 96
ssbo 2:1 96
ssbo 2:3 96

ssbo 0 subdata float  0 0.1 0.2 0.3 0.4
ssbo 0 subdata float 16 0.9 0.8 0.7 0.6

ssbo 1:0 subdata float  0 0.1 0.2 0.3 0.4
ssbo 1:2 subdata float  0 0.1 0.2 0.3 0.4
ssbo 2:1 subdata float  0 0.1 0.2 0.3 0.4
ssbo 2:3 subdata float  0 0.1 0.2 0.3 0.4

draw arrays TRIANGLE_LIST 0 6
relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (1.0, 0.75, 0.625, 0.5)



ssbo 0 subdata float  0 0.5 0.5 0.25 1.0 \
                        0.3 0.2 0.1  0.4 \
                        0   0   0    0

ssbo 1:0 subdata float 0 0.1 0.2  0.3  0.4 \
                         0.5 0.6  0.7  0.8 \
                         0.9 0.10 0.11     \
                         0.1 0.2  0.3  0.4 \
                         0.5 0.6  0.7  0.8 \
                         0.9 0.10 0.11

ssbo 1:2 subdata float 0 0.57 0.56 0.55 0.54 \
                         0.53 0.52 0.51 0.50 \
                         0.49 0.48 0.47      \
                         0.57 0.56 0.55 0.54 \
                         0.53 0.52 0.51 0.50 \
                         0.49 0.48 0.47

ssbo 2:1 subdata float 0 0.21 0.22 0.23 0.24 \
                         0.25 0.26 0.27 0.28 \
                         0.29 0.30 0.31      \
                         0.21 0.22 0.23 0.24 \
                         0.25 0.26 0.27 0.28 \
                         0.29 0.30 0.31

ssbo 2:3 subdata float 0 0.23  0.229 0.228 0.227 \
                         0.226 0.225 0.224 0.223 \
                         0.222 0.221 0.22        \
                         0.23  0.229 0.228 0.227 \
                         0.226 0.225 0.224 0.223 \
                         0.222 0.221 0.22

draw arrays TRIANGLE_LIST 0 6
relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.9, 0.6, 0.3, 0.7)

probe ssbo float 1:0 0  ~= 0.1 0.2  0.3  0.4 \
                           0.5 0.6  0.7  0.8 \
                           0.9 0.10 0.11
probe ssbo float 1:0 44 ~= 0.57 0.56 0.55 0.54 \
                           0.53 0.52 0.51 0.50 \
                           0.49 0.48 0.47

probe ssbo float 1:2 0  ~= 0.57 0.56 0.55 0.54 \
                           0.53 0.52 0.51 0.50 \
                           0.49 0.48 0.47
probe ssbo float 1:2 44 ~= 0.21 0.22 0.23 0.24 \
                           0.25 0.26 0.27 0.28 \
                           0.29 0.30 0.31

probe ssbo float 2:1 0  ~= 0.21 0.22 0.23 0.24 \
                           0.25 0.26 0.27 0.28 \
                           0.29 0.30 0.31
probe ssbo float 2:1 44 ~= 0.23  0.229 0.228 0.227 \
                           0.226 0.225 0.224 0.223 \
                           0.222 0.221 0.22

probe ssbo float 2:3 0  ~= 0.23  0.229 0.228 0.227 \
                           0.226 0.225 0.224 0.223 \
                           0.222 0.221 0.22
probe ssbo float 2:3 44 ~= 0.1 0.2  0.3  0.4 \
                           0.5 0.6  0.7  0.8 \
                           0.9 0.10 0.11



ssbo 0 subdata float  8 \
0.35 0.6 \
0.1  0.4
draw arrays TRIANGLE_LIST 0 6
relative probe rect rgba (0.0, 0.0, 1.0, 1.0) (0.8, 0.7, 0.35, 0.5)