@@ -971,50 +971,32 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType*
971971 }
972972 else if (String_Equal (functionName, " rsqrt" ))
973973 {
974- HLSLExpression* argument[1 ];
975- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
976- {
977- Error (" rsqrt expects 1 argument" );
978- return ;
979- }
980974 /* The documentation says that these functions return NaN for negative
981975 * arguments. However, testing with DX9 shader model 3 shows that they
982976 * most definitely do take the absolute value of the argument and do
983977 * NOT return NaN.
984978 * See https://github.com/projectM-visualizer/projectm/issues/724
985979 */
986980 m_writer.Write (" inversesqrt(abs(" );
987- OutputExpression ( argument[ 0 ] );
981+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
988982 m_writer.Write (" ))" );
989983 handled = true ;
990984 }
991985 else if (String_Equal (functionName, " sqrt" ) ||
992986 String_Equal (functionName, " log" ) ||
993987 String_Equal (functionName, " log2" ))
994988 {
995- HLSLExpression* argument[1 ];
996- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
997- {
998- Error (" %s expects 1 argument" , functionName);
999- return ;
1000- }
1001989 /* See rsqrt above */
1002990 m_writer.Write (" %s(abs(" , functionName);
1003- OutputExpression ( argument[ 0 ] );
991+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
1004992 m_writer.Write (" ))" );
1005993 handled = true ;
1006994 }
1007995 else if (String_Equal (functionName, " log10" ))
1008996 {
1009- HLSLExpression* argument[1 ];
1010- if (GetFunctionArguments (functionCall, argument, 1 ) != 1 )
1011- {
1012- Error (" %s expects 1 argument" , functionName);
1013- return ;
1014- }
1015997 /* See rsqrt above regarding abs(). */
1016998 m_writer.Write (" (log(abs(" );
1017- OutputExpression ( argument[ 0 ] );
999+ OutputExpressionList (functionCall-> argument , functionCall-> function -> argument );
10181000 m_writer.Write (" ))/log(10.0))" );
10191001 handled = true ;
10201002 }
@@ -1031,9 +1013,9 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType*
10311013 * the abs() call for compatibility across drivers.
10321014 */
10331015 m_writer.Write (" pow(abs(" );
1034- OutputExpression (argument[0 ]);
1016+ OutputExpression (argument[0 ], &functionCall-> function -> returnType );
10351017 m_writer.Write (" )," );
1036- OutputExpression (argument[1 ]);
1018+ OutputExpression (argument[1 ], &functionCall-> function -> returnType );
10371019 m_writer.Write (" )" );
10381020 handled = true ;
10391021 }
0 commit comments