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
16INSTANCE_EXTENSION VK_KHR_get_physical_device_properties2
17DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
18DEVICE_EXTENSION VK_KHR_16bit_storage
19DEVICE_FEATURE shaderInt16
20DEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess
21DEVICE_FEATURE Storage16BitFeatures.storagePushConstant16
22
23SHADER compute comp_shader GLSL
24#version 450
25#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
26
27layout(set=0, binding=0) buffer Buf {
28  int16_t value;
29} data;
30
31layout(push_constant) uniform PushConstantsBlock {
32  int16_t factor;
33} pushConstants;
34
35void main() {
36  data.value = data.value * pushConstants.factor;
37}
38END
39
40BUFFER buf DATA_TYPE int16 DATA 16383 END
41BUFFER pushc DATA_TYPE int16 DATA 2 END
42
43PIPELINE compute pipeline
44  ATTACH comp_shader
45
46  BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
47  BIND BUFFER pushc AS push_constant
48END
49
50RUN pipeline 1 1 1
51
52EXPECT buf IDX 0 EQ 32766
53