1e5c31af7Sopenharmony_ci#!amber
2e5c31af7Sopenharmony_ci# Copyright 2019 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_ciSHADER compute compute_shader GLSL
17e5c31af7Sopenharmony_ci#version 430
18e5c31af7Sopenharmony_ci
19e5c31af7Sopenharmony_cilayout(set = 0, binding = 0) buffer block0 {
20e5c31af7Sopenharmony_ci  mat2 identical_mat_0;
21e5c31af7Sopenharmony_ci};
22e5c31af7Sopenharmony_ci
23e5c31af7Sopenharmony_cilayout(set = 0, binding = 1) uniform block1 {
24e5c31af7Sopenharmony_ci  mat2 identical_mat_1;
25e5c31af7Sopenharmony_ci};
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_cilayout(set = 0, binding = 2) buffer block3 {
28e5c31af7Sopenharmony_ci  vec2 test0;
29e5c31af7Sopenharmony_ci  vec2 test1;
30e5c31af7Sopenharmony_ci};
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_civoid main() {
33e5c31af7Sopenharmony_ci  test0 = identical_mat_0 * test0;
34e5c31af7Sopenharmony_ci  test1 = identical_mat_1 * test1;
35e5c31af7Sopenharmony_ci}
36e5c31af7Sopenharmony_ciEND
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_ci# This is bound as an SSBO, so matrix stride is 8
39e5c31af7Sopenharmony_ciBUFFER buf0 DATA_TYPE mat2x2<float> DATA
40e5c31af7Sopenharmony_ci1.0 0.0
41e5c31af7Sopenharmony_ci0.0 1.0
42e5c31af7Sopenharmony_ciEND
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci# This is bound as a UBO so matrix stride is 16 due to GLSLang setting
45e5c31af7Sopenharmony_ci# STD140 layout.
46e5c31af7Sopenharmony_ciBUFFER buf1 DATA_TYPE mat2x2<float> DATA
47e5c31af7Sopenharmony_ci1.0 0.0 0.0 0.0
48e5c31af7Sopenharmony_ci0.0 1.0 0.0 0.0
49e5c31af7Sopenharmony_ciEND
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciBUFFER buf2 DATA_TYPE vec2<float> DATA
52e5c31af7Sopenharmony_ci3.7 9.4
53e5c31af7Sopenharmony_ci4.5 6.1
54e5c31af7Sopenharmony_ciEND
55e5c31af7Sopenharmony_ci
56e5c31af7Sopenharmony_ciPIPELINE compute pipeline
57e5c31af7Sopenharmony_ci  ATTACH compute_shader
58e5c31af7Sopenharmony_ci
59e5c31af7Sopenharmony_ci  BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0
60e5c31af7Sopenharmony_ci  BIND BUFFER buf1 AS uniform DESCRIPTOR_SET 0 BINDING 1
61e5c31af7Sopenharmony_ci  BIND BUFFER buf2 AS storage DESCRIPTOR_SET 0 BINDING 2
62e5c31af7Sopenharmony_ciEND
63e5c31af7Sopenharmony_ci
64e5c31af7Sopenharmony_ciRUN pipeline 1 1 1
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ciEXPECT buf2 IDX 0 EQ 3.7 9.4
67e5c31af7Sopenharmony_ciEXPECT buf2 IDX 8 EQ 4.5 6.1
68