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[compute shader]
16#version 430
17
18layout(set = 0, binding = 0) buffer block0 {
19  float data_set0_binding0[3];
20};
21
22layout(set = 1, binding = 2) buffer block1 {
23  float data_set1_binding2[3];
24};
25
26layout(set = 2, binding = 1) buffer block2 {
27  float data_set2_binding1[3];
28};
29
30layout(set = 2, binding = 3) buffer block3 {
31  float data_set2_binding3[3];
32};
33
34void main() {
35  const uint index = gl_WorkGroupID.x;
36  data_set0_binding0[index] = data_set0_binding0[index] + 1.0f;
37  data_set1_binding2[index] = data_set2_binding1[index] -
38                              data_set1_binding2[index];
39  data_set2_binding1[index] = 10.0f * data_set2_binding3[index] +
40                              data_set2_binding1[index];
41  data_set2_binding3[index] = 30.0f * data_set2_binding3[index];
42}
43
44[test]
45ssbo 0:0 subdata vec3  0  1.0  2.0  3.0
46ssbo 1:2 subdata vec3  0  4.0  5.0  6.0
47ssbo 2:1 subdata vec3  0 21.0 22.0 23.0
48ssbo 2:3 subdata vec3  0  0.7  0.8  0.9
49compute 3 1 1
50
51probe ssbo vec3 0:0 0 ~=  2.0  3.0  4.0
52probe ssbo vec3 1:2 0 ~= 17.0 17.0 17.0
53probe ssbo vec3 2:1 0 ~= 28.0 30.0 32.0
54probe ssbo vec3 2:3 0 ~= 21.0 24.0 27.0
55