aboutsummaryrefslogtreecommitdiff
path: root/tests/cases/compute_ssbo_with_tolerance.amber
blob: d8486f9509ab56ffb7626356265e3ce31e55b88a (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
# 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.

[compute shader]
#version 430

layout(set = 0, binding = 0) buffer block0 {
  float data_set0_binding0[3];
};

layout(set = 1, binding = 2) buffer block1 {
  float data_set1_binding2[3];
};

layout(set = 2, binding = 1) buffer block2 {
  float data_set2_binding1[3];
};

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

void main() {
  const uint index = gl_WorkGroupID.x;
  data_set0_binding0[index] = data_set0_binding0[index] + 1.0f;
  data_set1_binding2[index] = data_set2_binding1[index] -
                              data_set1_binding2[index];
  data_set2_binding1[index] = 10.0f * data_set2_binding3[index] +
                              data_set2_binding1[index];
  data_set2_binding3[index] = 30.0f * data_set2_binding3[index];
}

[test]
ssbo 0:0 subdata vec3  0  1.0  2.0  3.0
ssbo 1:2 subdata vec3  0  4.0  5.0  6.0
ssbo 2:1 subdata vec3  0 21.0 22.0 23.0
ssbo 2:3 subdata vec3  0  0.7  0.8  0.9
compute 3 1 1

probe ssbo vec3 0:0 0 ~=  2.0  3.0  4.0
probe ssbo vec3 1:2 0 ~= 17.0 17.0 17.0
probe ssbo vec3 2:1 0 ~= 28.0 30.0 32.0
probe ssbo vec3 2:3 0 ~= 21.0 24.0 27.0

tolerance 1.0
probe ssbo vec3 0:0 0 ~=  2.99  3.99  4.99
probe ssbo vec3 1:2 0 ~= 17.99 17.99 17.99
probe ssbo vec3 2:1 0 ~= 28.99 30.99 32.99
probe ssbo vec3 2:3 0 ~= 21.99 24.99 27.99

tolerance 1.0%
probe ssbo vec3 0:0 0 ~=  2.0199  3.0199  4.0199
probe ssbo vec3 1:2 0 ~= 17.0199 17.0199 17.0199
probe ssbo vec3 2:1 0 ~= 28.0199 30.0199 32.0199
probe ssbo vec3 2:3 0 ~= 21.0199 24.0199 27.0199