blob: c6975d7d551b6b588b673bfa1f89ed22b89b76cb [file] [log] [blame]
#!amber
# Copyright 2021 Google LLC.
# Copyright 2021 The Khronos Group Inc.
#
# 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
#
# http://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.
#
# Matrix 4x4 determinant precision test 16bit
DEVICE_EXTENSION VK_KHR_storage_buffer_storage_class
DEVICE_EXTENSION VK_KHR_16bit_storage
DEVICE_FEATURE Float16Int8Features.shaderFloat16
SHADER compute compute_shader GLSL
#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable
const int NUMMATRICES = 10;
layout(set = 0, binding = 0) buffer block0
{
mat4 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat4 matIn = f16mat4(matIns[ndx]);
float16_t det16bit = determinant(matIn);
detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0)));
}
}
END
BUFFER bufIn DATA_TYPE mat4x4<float> DATA
-1.0 1.0 4.0 2.0
2.0 -1.0 2.0 5.0
1.0 2.0 3.0 4.0
3.0 4.0 -1.0 2.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
-0.08837890625 0.1569824219 0.001299858093 0.2451171875
0.0380859375 0.7124023438 -0.003200531006 0.9111328125
0.07598876953 0.09777832031 -1.060546875 1.904296875
-0.4968261719 1.595703125 0.01309967041 -2.6953125
42 0.3000488281 -0.04800415039 -270
15 4.80078125 -4.8984375 -41
-0.1800537109 -0.7001953125 -0.02299499512 0.3701171875
-0.000500202179 -0.002799987793 -0.7998046875 -0.2900390625
500 -3.599609375 -15 37
2.900390625 -0.4699707031 3.19921875 4.69921875
0.09997558594 0.04400634766 0.005001068115 -0.02799987793
-48 19 -1.099609375 0.03799438477
-17 -1100 -100 -0.01800537109
6 43 -3.099609375 20
-2.30078125 0.002700805664 -0.000500202179 -1.900390625
0.3601074219 0.3100585938 -0.00479888916 0.02699279785
-3.384765625 3.154296875 -9.8671875 1.489257812
-1.336914062 1.853515625 13.1875 4.7734375
-2.580078125 54.8125 -5.62890625 -1.877929688
-0.7348632812 -1.95703125 1.390625 5.82421875
-1.60546875 -18.71875 -2.263671875 2.4296875
-2.67578125 -7.33984375 226.5 3.841796875
9.5234375 -3.541015625 -2.8828125 1.755859375
1.602539062 1.243164062 10.6796875 -0.7749023438
25.703125 1.28125 2.548828125 -2.83203125
-1.983398438 -2.9296875 -6.0625 -1.15625
-2.45703125 -39.84375 0.8330078125 -4.12109375
0.814453125 0.6962890625 3.279296875 -2.87109375
-13.421875 -1.57421875 4.17578125 4.421875
-1.33300781 2.875 -5.18359375 1.84960938
-1.30273438 -5.03125 -0.909179688 1.53710938
-17.03125 1.13378906 2.16601562 -1.44628906
END
BUFFER bufOut DATA_TYPE float SIZE 10 FILL 0.0
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER bufIn AS storage DESCRIPTOR_SET 0 BINDING 0
BIND BUFFER bufOut AS storage DESCRIPTOR_SET 0 BINDING 1
END
RUN pipeline 1 1 1
EXPECT bufOut IDX 0 TOLERANCE 0.00000762939453125 EQ -0.007861733437
EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.007857322693
EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.007855851203
EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.007836524397
EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.007867698558
EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.007838701829
EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.007839817554
EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.007841326296
EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.007840413600
EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.007868356071