Skip to content

Match math function behavior to DX9 implementation #778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dpw13
Copy link
Collaborator

@dpw13 dpw13 commented Feb 12, 2024

See #724

@dpw13 dpw13 force-pushed the dev/dwagner-instrinsic-domains branch 2 times, most recently from 6e4f8c5 to 4a4e420 Compare February 12, 2024 22:10
@kblaschke
Copy link
Member

        else if (String_Equal(functionName, "pow"))
        {
            HLSLExpression* argument[2];
            if (GetFunctionArguments(functionCall, argument, 2) != 2)
            {
                Error("%s expects 2 arguments", functionName);
                return;
            }
            // See rsqrt above regarding abs().
            m_writer.Write("pow(abs(");
            OutputExpression(argument[0]);
            m_writer.Write("),");
            OutputExpression(argument[1], &functionCall->function->argument->type);
            m_writer.Write(")");
            handled = true;
        }

Adding this after handling log10 in GLSLGenerator.cpp fixes "stormy sea", as pow() is also affected by the NaN madness.

@kblaschke kblaschke added this to the 4.1 milestone Feb 13, 2024
@dpw13 dpw13 force-pushed the dev/dwagner-instrinsic-domains branch from 167e982 to ffaaf56 Compare February 16, 2024 13:22
@kblaschke kblaschke merged commit 04be6f4 into projectM-visualizer:master Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants