| #!amber |
| # |
| # Copyright 2020 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. |
| |
| SHADER compute compute_shader GLSL |
| #version 430 |
| |
| layout(set = 0, binding = 0) buffer block0 { |
| float in_data[12]; |
| }; |
| |
| layout(set = 0, binding = 1) buffer block1 { |
| float out_data[12]; |
| }; |
| |
| void main() { |
| for (int i = 0; i < 12; i++) |
| out_data[i] = in_data[i] * 2.0; |
| } |
| END |
| |
| BUFFER buf0 DATA_TYPE vec4<float> SIZE 3 FILE TEXT vec4data.txt |
| BUFFER buf1 DATA_TYPE vec4<float> SIZE 3 FILL 0.0 |
| |
| BUFFER ref0 DATA_TYPE vec4<float> DATA |
| 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 |
| END |
| |
| BUFFER ref1 DATA_TYPE vec4<float> DATA |
| 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 24.0 |
| END |
| |
| PIPELINE compute pipeline |
| ATTACH compute_shader |
| |
| BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0 |
| BIND BUFFER buf1 AS storage DESCRIPTOR_SET 0 BINDING 1 |
| END |
| |
| RUN pipeline 1 1 1 |
| |
| EXPECT buf0 EQ_BUFFER ref0 |
| EXPECT buf1 EQ_BUFFER ref1 |