GLSL: Fix missing precision qualifier in spvDeterminant return value

Follow-up to #2100
This commit is contained in:
rdb 2023-01-27 21:44:47 +01:00
parent 199d0cb8a9
commit c356dd6220
3 changed files with 9 additions and 9 deletions

View File

@ -20,17 +20,17 @@ varying mat2 o2r;
varying mat3 o3r;
varying mat4 o4r;
float spvDeterminant(highp mat2 m)
highp float spvDeterminant(highp mat2 m)
{
return m[0][0] * m[1][1] - m[0][1] * m[1][0];
}
float spvDeterminant(highp mat3 m)
highp float spvDeterminant(highp mat3 m)
{
return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]));
}
float spvDeterminant(highp mat4 m)
highp float spvDeterminant(highp mat4 m)
{
return dot(m[0], vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]));
}

View File

@ -20,17 +20,17 @@ varying mat2 o2r;
varying mat3 o3r;
varying mat4 o4r;
float spvDeterminant(highp mat2 m)
highp float spvDeterminant(highp mat2 m)
{
return m[0][0] * m[1][1] - m[0][1] * m[1][0];
}
float spvDeterminant(highp mat3 m)
highp float spvDeterminant(highp mat3 m)
{
return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], m[1][2] * m[2][0] - m[1][0] * m[2][2], m[1][0] * m[2][1] - m[1][1] * m[2][0]));
}
float spvDeterminant(highp mat4 m)
highp float spvDeterminant(highp mat4 m)
{
return dot(m[0], vec4(m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], m[3][0] * m[2][2] * m[1][3] - m[2][0] * m[3][2] * m[1][3] - m[3][0] * m[1][2] * m[2][3] + m[1][0] * m[3][2] * m[2][3] + m[2][0] * m[1][2] * m[3][3] - m[1][0] * m[2][2] * m[3][3], m[2][0] * m[3][1] * m[1][3] - m[3][0] * m[2][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3] - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] + m[1][0] * m[2][1] * m[3][3], m[3][0] * m[2][1] * m[1][2] - m[2][0] * m[3][1] * m[1][2] - m[3][0] * m[1][1] * m[2][2] + m[1][0] * m[3][1] * m[2][2] + m[2][0] * m[1][1] * m[3][2] - m[1][0] * m[2][1] * m[3][2]));
}

View File

@ -4456,7 +4456,7 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed)
if (polyfills & PolyfillDeterminant2x2)
{
statement("float spvDeterminant", suffix, "(", qual, "mat2 m)");
statement(qual, "float spvDeterminant", suffix, "(", qual, "mat2 m)");
begin_scope();
statement("return m[0][0] * m[1][1] - m[0][1] * m[1][0];");
end_scope();
@ -4465,7 +4465,7 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed)
if (polyfills & PolyfillDeterminant3x3)
{
statement("float spvDeterminant", suffix, "(", qual, "mat3 m)");
statement(qual, "float spvDeterminant", suffix, "(", qual, "mat3 m)");
begin_scope();
statement("return dot(m[0], vec3(m[1][1] * m[2][2] - m[1][2] * m[2][1], "
"m[1][2] * m[2][0] - m[1][0] * m[2][2], "
@ -4476,7 +4476,7 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed)
if (polyfills & PolyfillDeterminant4x4)
{
statement("float spvDeterminant", suffix, "(", qual, "mat4 m)");
statement(qual, "float spvDeterminant", suffix, "(", qual, "mat4 m)");
begin_scope();
statement("return dot(m[0], vec4("
"m[2][1] * m[3][2] * m[1][3] - m[3][1] * m[2][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3] - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] + m[1][1] * m[2][2] * m[3][3], "