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