• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!amber
2#
3# Copyright 2020 The Amber Authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     https://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17SHADER compute compute_shader GLSL
18#version 430
19
20layout(set = 0, binding = 0) buffer block0 {
21  float in_data[12];
22};
23
24layout(set = 0, binding = 1) buffer block1 {
25  float out_data[12];
26};
27
28void main() {
29    for (int i = 0; i < 12; i++)
30        out_data[i] = in_data[i] * 2.0;
31}
32END
33
34BUFFER buf0 DATA_TYPE vec4<float> SIZE 3 FILE TEXT vec4data.txt
35BUFFER buf1 DATA_TYPE vec4<float> SIZE 3 FILL 0.0
36
37BUFFER ref0 DATA_TYPE vec4<float> DATA
381.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0
39END
40
41BUFFER ref1 DATA_TYPE vec4<float> DATA
422.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 24.0
43END
44
45PIPELINE compute pipeline
46  ATTACH compute_shader
47
48  BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0
49  BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1
50END
51
52RUN pipeline 1 1 1
53
54EXPECT buf0 EQ_BUFFER ref0
55EXPECT buf1 EQ_BUFFER ref1
56