rsx/common/d3d12/gl: Mimic divsq and rsq fragment instruction behaviour with 0.

Fix Super Puzzle Turbo HD 2 and SH3 HD
This commit is contained in:
Vincent Lejeune 2016-01-03 18:40:19 +01:00
parent 31a925b4f0
commit 675ccd4510
3 changed files with 46 additions and 4 deletions

View file

@ -141,6 +141,24 @@ void D3D12FragmentDecompiler::insertConstants(std::stringstream & OS)
void D3D12FragmentDecompiler::insertMainStart(std::stringstream & OS)
{
// "lib" function
// 0.00001 is used as "some non zero very little number"
OS << "float4 divsq_legacy(float4 num, float4 denum)\n";
OS << "{\n";
OS << " return num / sqrt(max(denum.xxxx, 0.00001));\n";
OS << "}\n";
OS << "float4 rcp_legacy(float4 denum)\n";
OS << "{\n";
OS << " return 1. / denum;\n";
OS << "}\n";
OS << "float4 rsq_legacy(float4 denum)\n";
OS << "{\n";
OS << " return 1. / sqrt(max(denum, 0.00001));\n";
OS << "}\n";
const std::set<std::string> output_value =
{
"r0", "r1", "r2", "r3", "r4",