You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
4 months ago
|
#!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
|
||
|
{
|
||
|
vec4 data0;
|
||
|
};
|
||
|
|
||
|
layout(set = 0, binding = 1) buffer block1
|
||
|
{
|
||
|
vec4 data1;
|
||
|
};
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
data0 = vec4(1, 2, 3, 4);
|
||
|
data1 = vec4(5, 6, 7, 8);
|
||
|
}
|
||
|
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 buf0 DATA_TYPE vec4<float> SIZE 17 FILL 0.0
|
||
|
BUFFER buf1 DATA_TYPE vec4<float> SIZE 17 FILL 0.0
|
||
|
|
||
|
PIPELINE compute pipeline
|
||
|
ATTACH compute_shader
|
||
|
|
||
|
BIND BUFFER buf0 AS storage_dynamic DESCRIPTOR_SET 0 BINDING 0 OFFSET 0
|
||
|
# Using the maximum possible required offset alignment of 256 bytes to support all implementations.
|
||
|
BIND BUFFER buf1 AS storage_dynamic DESCRIPTOR_SET 0 BINDING 1 OFFSET 256
|
||
|
END
|
||
|
|
||
|
RUN pipeline 1 1 1
|
||
|
|
||
|
EXPECT buf0 IDX 0 EQ 1.0 2.0 3.0 4.0
|
||
|
EXPECT buf1 IDX 256 EQ 5.0 6.0 7.0 8.0
|