1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci# Copyright 2020 The Amber Authors.
3e5c31af7Sopenharmony_ci#
4e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
5e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
6e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
7e5c31af7Sopenharmony_ci#
8e5c31af7Sopenharmony_ci#     https://www.apache.org/licenses/LICENSE-2.0
9e5c31af7Sopenharmony_ci#
10e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
11e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
12e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
14e5c31af7Sopenharmony_ci# limitations under the License.
15e5c31af7Sopenharmony_ci
16e5c31af7Sopenharmony_ciINSTANCE_EXTENSION VK_KHR_get_physical_device_properties2
17e5c31af7Sopenharmony_ciDEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
18e5c31af7Sopenharmony_ciDEVICE_EXTENSION VK_KHR_16bit_storage
19e5c31af7Sopenharmony_ciDEVICE_FEATURE shaderInt16
20e5c31af7Sopenharmony_ciDEVICE_FEATURE Storage16BitFeatures.uniformAndStorageBuffer16BitAccess
21e5c31af7Sopenharmony_ciDEVICE_FEATURE Storage16BitFeatures.storagePushConstant16
22e5c31af7Sopenharmony_ciDEVICE_FEATURE Storage16BitFeatures.storageBuffer16BitAccess
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ciSHADER compute comp_shader GLSL
25e5c31af7Sopenharmony_ci#version 450
26e5c31af7Sopenharmony_ci#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_cilayout(set=0, binding=0) buffer Buf {
29e5c31af7Sopenharmony_ci  int16_t value;
30e5c31af7Sopenharmony_ci} data;
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_cilayout(push_constant) uniform PushConstantsBlock {
33e5c31af7Sopenharmony_ci  int16_t factor;
34e5c31af7Sopenharmony_ci} pushConstants;
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_civoid main() {
37e5c31af7Sopenharmony_ci  data.value = data.value * pushConstants.factor;
38e5c31af7Sopenharmony_ci}
39e5c31af7Sopenharmony_ciEND
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ciBUFFER buf DATA_TYPE int16 DATA 16383 END
42e5c31af7Sopenharmony_ciBUFFER pushc DATA_TYPE int16 DATA 2 END
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ciPIPELINE compute pipeline
45e5c31af7Sopenharmony_ci  ATTACH comp_shader
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci  BIND BUFFER buf AS storage DESCRIPTOR_SET 0 BINDING 0
48e5c31af7Sopenharmony_ci  BIND BUFFER pushc AS push_constant
49e5c31af7Sopenharmony_ciEND
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciRUN pipeline 1 1 1
52e5c31af7Sopenharmony_ci
53e5c31af7Sopenharmony_ciEXPECT buf IDX 0 EQ 32766
54