From ef822d785eae713a0cee9d99e5d298e9b6422a22 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 21 Mar 2017 14:53:52 +0300 Subject: [PATCH] rsx/fp: src3 workaround --- rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp | 10 +++++++++- rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp index 915afafe53..544b1dc7a8 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp @@ -159,6 +159,11 @@ std::string FragmentProgramDecompiler::AddTex() return m_parr.AddParam(PF_PARAM_UNIFORM, sampler, std::string("tex") + std::to_string(dst.tex_num)); } +std::string FragmentProgramDecompiler::AddType3() +{ + return m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "src3", getFloatTypeName(4) + "(1., 1., 1., 1.)"); +} + //Both of these were tested with a trace SoulCalibur IV title screen //Failure to catch causes infinite values since theres alot of rcp(0) std::string FragmentProgramDecompiler::NotZero(const std::string& code) @@ -358,7 +363,10 @@ template std::string FragmentProgramDecompiler::GetSRC(T src) break; case RSX_FP_REGISTER_TYPE_UNKNOWN: // ??? Used by a few games, what is it? - LOG_ERROR(RSX, "Src type 3 used, please report this to a developer."); + LOG_ERROR(RSX, "Src type 3 used, opcode=0x%X, dst=0x%X s0=0x%X s1=0x%X s2=0x%X", + dst.opcode, dst.HEX, src0.HEX, src1.HEX, src2.HEX); + + ret += AddType3(); break; default: diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h index c698de1bac..cb904fd6a0 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.h @@ -46,6 +46,9 @@ class FragmentProgramDecompiler std::string AddTex(); std::string Format(const std::string& code); + //Technically a temporary workaround until we know what type3 is + std::string AddType3(); + //Prevent division by zero by catching denormals //Simpler variant where input and output are expected to be positive std::string NotZero(const std::string& code);