• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2# Copyright 2020 The Amber Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16SHADER compute compute_shader GLSL
17#version 450
18layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
19
20layout(binding = 0) buffer block0
21{
22    int data;
23} ssbo_array_0[2];
24
25layout(binding = 1) buffer block1
26{
27    int data;
28} ssbo_array_1[2];
29
30void main()
31{
32    ssbo_array_0[0].data = 1;
33    ssbo_array_0[1].data = 2;
34    ssbo_array_1[0].data = 3;
35    ssbo_array_1[1].data = 4;
36}
37END
38
39BUFFER buf0 DATA_TYPE int32 DATA
400
41END
42
43BUFFER buf1 DATA_TYPE int32 DATA
440
45END
46
47# The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment
48# (i.e. the maximum possible alignment requirement) as 256 bytes, so we will use
49# buffer with size of 65 int32 values = 260 bytes.
50BUFFER buf2 DATA_TYPE int32 SIZE 65 FILL 0
51
52PIPELINE compute pipeline
53  ATTACH compute_shader
54
55  BIND BUFFER_ARRAY buf0 buf1 AS storage DESCRIPTOR_SET 0 BINDING 0
56  BIND BUFFER_ARRAY buf2 buf2 AS storage DESCRIPTOR_SET 0 BINDING 1 DESCRIPTOR_OFFSET 0 256 DESCRIPTOR_RANGE 256 4
57END
58
59RUN pipeline 1 1 1
60
61EXPECT buf0 IDX 0 EQ 1
62EXPECT buf1 IDX 0 EQ 2
63EXPECT buf2 IDX 0 EQ 3
64EXPECT buf2 IDX 256 EQ 4
65