@@ -971,50 +971,32 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType*
971
971
}
972
972
else if (String_Equal (functionName, " rsqrt" ))
973
973
{
974
- HLSLExpression* argument[1 ];
975
- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
976
- {
977
- Error (" rsqrt expects 1 argument" );
978
- return ;
979
- }
980
974
/* The documentation says that these functions return NaN for negative
981
975
* arguments. However, testing with DX9 shader model 3 shows that they
982
976
* most definitely do take the absolute value of the argument and do
983
977
* NOT return NaN.
984
978
* See https://github.com/projectM-visualizer/projectm/issues/724
985
979
*/
986
980
m_writer.Write (" inversesqrt(abs(" );
987
- OutputExpression ( argument[ 0 ] );
981
+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
988
982
m_writer.Write (" ))" );
989
983
handled = true ;
990
984
}
991
985
else if (String_Equal (functionName, " sqrt" ) ||
992
986
String_Equal (functionName, " log" ) ||
993
987
String_Equal (functionName, " log2" ))
994
988
{
995
- HLSLExpression* argument[1 ];
996
- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
997
- {
998
- Error (" %s expects 1 argument" , functionName);
999
- return ;
1000
- }
1001
989
/* See rsqrt above */
1002
990
m_writer.Write (" %s(abs(" , functionName);
1003
- OutputExpression ( argument[ 0 ] );
991
+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
1004
992
m_writer.Write (" ))" );
1005
993
handled = true ;
1006
994
}
1007
995
else if (String_Equal (functionName, " log10" ))
1008
996
{
1009
- HLSLExpression* argument[1 ];
1010
- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
1011
- {
1012
- Error (" %s expects 1 argument" , functionName);
1013
- return ;
1014
- }
1015
997
/* See rsqrt above regarding abs(). */
1016
998
m_writer.Write (" (log(abs(" );
1017
- OutputExpression ( argument[ 0 ] );
999
+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
1018
1000
m_writer.Write (" ))/log(10.0))" );
1019
1001
handled = true ;
1020
1002
}
@@ -1031,9 +1013,9 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType*
1031
1013
* the abs() call for compatibility across drivers.
1032
1014
*/
1033
1015
m_writer.Write (" pow(abs(" );
1034
- OutputExpression (argument[0 ]);
1016
+ OutputExpression (argument[0 ], &functionCall-> function -> returnType );
1035
1017
m_writer.Write (" )," );
1036
- OutputExpression (argument[1 ]);
1018
+ OutputExpression (argument[1 ], &functionCall-> function -> returnType );
1037
1019
m_writer.Write (" )" );
1038
1020
handled = true ;
1039
1021
}
0 commit comments