• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 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  uint data_set0_binding0[];
20};
21
22// push_constant compiled as std430 by glslang
23layout(push_constant) uniform block1 {
24  uint constant0[3];  // Offset:  0, array stride:  4
25  uint constant1;      //         12
26  uvec3 constant2[3];   //         16, array stride: 16
27  uint constant3;      //         64
28};
29
30void main() {
31  int offset = 0;
32  for (int i = 0; i < 3; ++i)
33    data_set0_binding0[offset++] = constant0[i];
34
35  data_set0_binding0[offset++] = constant1;
36
37  for (int i = 0; i < 3; ++i)
38    for (int j = 0; j < 3; ++j)
39      data_set0_binding0[offset++] = constant2[i][j];
40
41  data_set0_binding0[offset++] = constant3;
42}
43
44[test]
45ssbo 0:0 56
46
47uniform uint  0  1  2  3
48uniform uint 12  4
49uniform uint 16  5  6  7  0 \
50                 8  9  10 0 \
51                 11 12 13
52uniform uint 64 14
53
54compute 3 1 1
55
56probe ssbo uint 0:0  0 ==  1  2  3
57probe ssbo uint 0:0 12 ==  4
58probe ssbo uint 0:0 16 ==  5  6  7  \
59                           8  9  10 \
60                           11 12 13
61probe ssbo uint 0:0 52 ==  14
62