| #!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 = 1) buffer block0 |
| { |
| vec4 data; |
| }; |
| |
| void main() |
| { |
| data = vec4(1, 2, 3, 4); |
| } |
| END |
| |
| BUFFER buf_unused DATA_TYPE vec4<float> DATA |
| 0.0 0.0 0.0 0.0 |
| 1.0 1.0 1.0 1.0 |
| 2.0 2.0 2.0 2.0 |
| END |
| |
| # The Vulkan spec lists the maximum value of minStorageBufferOffsetAlignment |
| # (i.e. the maximum possible alignment requirement) as 256 bytes. |
| # Allocate enough space to hold one vec4 (each 16 bytes) |
| # after the alignment (256 / 16 + 1). |
| BUFFER buf DATA_TYPE vec4<float> SIZE 17 FILL 0.0 |
| |
| PIPELINE compute pipeline0 |
| ATTACH compute_shader |
| |
| BIND BUFFER buf_unused AS uniform_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0 |
| BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 0 |
| END |
| |
| PIPELINE compute pipeline1 |
| ATTACH compute_shader |
| |
| BIND BUFFER buf AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256 |
| END |
| |
| RUN pipeline0 1 1 1 |
| RUN pipeline1 1 1 1 |
| |
| EXPECT buf IDX 0 EQ 1.0 2.0 3.0 4.0 |
| EXPECT buf IDX 256 EQ 1.0 2.0 3.0 4.0 |