blob: 7fe4d54e114b4de102bf21128ed54877d2d624ab [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 inverse 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
{
mat3 invOutM[NUMMATRICES];
};
void main()
{
for (int ndx = 0; ndx < NUMMATRICES; ndx++)
{
f16mat3 matIn_16 = f16mat3(matIns[ndx]);
f16mat3 matInv_16 = inverse(matIn_16);
f16mat3 transMat_16 = f16mat3(vec3(matIn_16[0][0], matIn_16[1][0], matIn_16[2][0]),
vec3(matIn_16[0][1], matIn_16[1][1], matIn_16[2][1]),
vec3(matIn_16[0][2], matIn_16[1][2], matIn_16[2][2]));
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
invOutM[ndx][row][col] = uintBitsToFloat(packFloat2x16(f16vec2(matInv_16[row][col], -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
1.71191406 -6.6796875 3.72460938
4.828125 0.152832031 0.327636719
-0.126586914 1.70605469 0.860351562
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 mat3x3<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.0078562144190073 -0.00782368611544371 -0.00782512966543436 -0.00782518088817596 -0.00785453896969557 -0.00785134267061949 -0.0078532500192523 -0.00782443396747112 -0.00785379111766815
EXPECT bufOut IDX 48 TOLERANCE 0.00000762939453125 EQ -0.00782680511474609 -0.00785732269287109 -0.007843017578125 -0.00785732269287109 -0.007843017578125 -0.00782680511474609 -0.007843017578125 -0.00782680511474609 -0.007843017578125
EXPECT bufOut IDX 96 TOLERANCE 0.00000762939453125 EQ -0.00784752238541842 -0.00782798510044813 -0.00785871222615242 -0.0078544681891799 -0.0078347260132432 -0.00786453858017921 -0.00785158388316631 -0.00786159280687571 -0.00783040374517441
EXPECT bufOut IDX 144 TOLERANCE 0.00000762939453125 EQ -0.00785949360579252 -0.00781868956983089 -0.00782319065183401 -0.00786344427615404 -0.0078260563313961 -0.00782713387161493 -0.00785725098103285 -0.00781663320958614 -0.00785203743726015
EXPECT bufOut IDX 192 TOLERANCE 0.00000762939453125 EQ -0.00785310473293066 -0.00784990470856428 -0.00785593315958977 -0.00782180111855268 -0.00782043673098087 -0.0078520905226469 -0.00782219227403402 -0.00784830655902624 -0.00785365328192711
EXPECT bufOut IDX 240 TOLERANCE 0.00000762939453125 EQ -0.00785053987056017 -0.00782458204776049 -0.00785305164754391 -0.00785365793853998 -0.00782210659235716 -0.00782508961856365 -0.0078240754082799 -0.00785269215703011 -0.00782596692442894
EXPECT bufOut IDX 288 TOLERANCE 0.00000762939453125 EQ -0.00782249309122562 -0.00782015733420849 -0.00782187841832638 -0.00785263068974018 -0.00785313174128532 -0.00785532407462597 -0.00785235036164522 -0.00785354617983103 -0.00785256922245026
EXPECT bufOut IDX 336 TOLERANCE 0.00000762939453125 EQ -0.00782382301986217 -0.00785266328603029 -0.00782157573848963 -0.00782686658203602 -0.00785550847649574 -0.00782235898077488 -0.0078593110665679 -0.00782712083309889 -0.00785486306995153
EXPECT bufOut IDX 384 TOLERANCE 0.00000762939453125 EQ -0.00782125908881426 -0.00785109400749207 -0.0078533822670579 -0.00785357225686312 -0.00782414898276329 -0.00784495379775763 -0.00782443396747112 -0.0078235175460577 -0.00782245025038719
EXPECT bufOut IDX 432 TOLERANCE 0.00000762939453125 EQ -0.00782448425889015 -0.00785084161907434 -0.00785383861511946 -0.00782214943319559 -0.00785311032086611 -0.00782076641917229 -0.00782483350485563 -0.0078211622312665 -0.00782250612974167