rsx/common/d3d12: Support non default alpha function

Fix After burner climax cloud effects.
This commit is contained in:
Vincent Lejeune 2016-02-06 19:54:12 +01:00
parent 9e3132c3fc
commit 837e06e85b
7 changed files with 60 additions and 3 deletions

View file

@ -253,7 +253,30 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS)
}
// Shaders don't always output colors (for instance if they write to depth only)
if (!first_output_name.empty())
OS << " if (isAlphaTested && Out." << first_output_name << ".a <= alphaRef) discard;\n";
{
switch (m_prog.alpha_func)
{
case rsx::comparaison_function::equal:
OS << " if (isAlphaTested && Out." << first_output_name << ".a != alphaRef) discard;\n";
break;
case rsx::comparaison_function::not_equal:
OS << " if (isAlphaTested && Out." << first_output_name << ".a == alphaRef) discard;\n";
break;
case rsx::comparaison_function::less_or_equal:
OS << " if (isAlphaTested && Out." << first_output_name << ".a > alphaRef) discard;\n";
break;
case rsx::comparaison_function::less:
OS << " if (isAlphaTested && Out." << first_output_name << ".a >= alphaRef) discard;\n";
break;
case rsx::comparaison_function::greater:
OS << " if (isAlphaTested && Out." << first_output_name << ".a <= alphaRef) discard;\n";
break;
case rsx::comparaison_function::greater_or_equal:
OS << " if (isAlphaTested && Out." << first_output_name << ".a < alphaRef) discard;\n";
break;
}
}
OS << " return Out;" << std::endl;
OS << "}" << std::endl;
}