blob: e05024898838152d8d3ff55e6b014339d670f9ac [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 3x3 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
{
mat3 matIns[NUMMATRICES];
};
layout(set = 0, binding = 1) buffer block1
{
float detM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn = f16mat3(matIns[ndx]);
float16_t det16bit = determinant(matIn);
detM[ndx] = uintBitsToFloat(packFloat2x16(f16vec2(det16bit, -1.0)));
}
}
END
BUFFER bufIn DATA_TYPE mat3x3<float> DATA
1.0 5.0 3.0
2.0 4.0 7.0
4.0 6.0 2.0
1.0 0.0 1.0
0.0 0.0 1.0
1.0 1.0 1.0
-0.00400161743164062 -2.900390625 -41
-0.419921875 0.00490188598632812 -0.016998291015625
-0.7001953125 0.00500106811523438 -0.00259971618652344
-0.140000000596046 0.00109999999403954 -0.399999976158142
-32 1.80000007152557 -0.046000003814697
5 0.00500000035390258 -27
-4.0234375 1.2275390625 21.125
5.73828125 90.5625 -60.4375
-2.1484375 -1.27734375 -1.951171875
6 4.80078125 0.1500244140625
-100 3.599609375 3.099609375
-50 0.040008544921875 80
24.171875 2.798828125 0.82958984375
-9.703125 1.1630859375 -17.46875
-1.3828125 -4.83984375 3.56640625
-1.615234375 5.9296875 1.181640625
1.7802734375 19.1875 4.7578125
52.8125 -1.1171875 1.1513671875
3.17578125 -2.3984375 4.12890625
1.3818359375 5.53125 1.8154296875
-16.40625 -1.8486328125 0.95263671875
1.615234375 0.62890625 2.73828125
-0.9716796875 -18.828125 3.509765625
-8.015625 3.5703125 5.98046875
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.00783267617225647
EXPECT bufOut IDX 4 TOLERANCE 0.00000762939453125 EQ -0.00785732269287109
EXPECT bufOut IDX 8 TOLERANCE 0.00000762939453125 EQ -0.00785386469215155
EXPECT bufOut IDX 12 TOLERANCE 0.00000762939453125 EQ -0.00782984681427479
EXPECT bufOut IDX 16 TOLERANCE 0.00000762939453125 EQ -0.00783849507570267
EXPECT bufOut IDX 20 TOLERANCE 0.00000762939453125 EQ -0.00784130394458771
EXPECT bufOut IDX 24 TOLERANCE 0.00000762939453125 EQ -0.00786752626299858
EXPECT bufOut IDX 28 TOLERANCE 0.00000762939453125 EQ -0.00783427059650421
EXPECT bufOut IDX 32 TOLERANCE 0.00000762939453125 EQ -0.00783521682024002
EXPECT bufOut IDX 36 TOLERANCE 0.00000762939453125 EQ -0.00786614231765270