From 1ea5e7404af33871a085a0418364d102a6b81fc9 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sun, 31 Dec 2017 10:08:09 +0300 Subject: [PATCH] rsx: Workaround for nvidia linux - For some reason, using 1.E-x notation does not work on nvidia linux. Could be a bug in spir-v generator or the driver itself --- rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp | 4 ++-- rpcs3/Emu/RSX/Common/GLSLCommon.h | 2 +- rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp index 03227f8de5..1d00c820be 100644 --- a/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/FragmentProgramDecompiler.cpp @@ -195,12 +195,12 @@ std::string FragmentProgramDecompiler::AddX2d() //Failure to catch causes infinite values since theres alot of rcp(0) std::string FragmentProgramDecompiler::NotZero(const std::string& code) { - return "(max(abs(" + code + "), 1.E-10) * sign(" + code + "))"; + return "(max(abs(" + code + "), 0.000001) * sign(" + code + "))"; } std::string FragmentProgramDecompiler::NotZeroPositive(const std::string& code) { - return "max(abs(" + code + "), 1.E-10)"; + return "max(abs(" + code + "), 0.000001)"; } std::string FragmentProgramDecompiler::ClampValue(const std::string& code, u32 precision) diff --git a/rpcs3/Emu/RSX/Common/GLSLCommon.h b/rpcs3/Emu/RSX/Common/GLSLCommon.h index 34fc8554f1..e3232404ca 100644 --- a/rpcs3/Emu/RSX/Common/GLSLCommon.h +++ b/rpcs3/Emu/RSX/Common/GLSLCommon.h @@ -337,7 +337,7 @@ namespace glsl OS << " result.x = 1.;\n"; OS << " result.w = 1.;\n"; OS << " result.y = clamped_val.x;\n"; - OS << " result.z = clamped_val.x > 0. ? exp(clamped_val.w * log(max(clamped_val.y, 1.E-10))) : 0.;\n"; + OS << " result.z = clamped_val.x > 0. ? exp(clamped_val.w * log(max(clamped_val.y, 0.000001))) : 0.;\n"; OS << " return result;\n"; OS << "}\n\n"; diff --git a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp index e195e57a9c..81f5750f8c 100644 --- a/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/Common/VertexProgramDecompiler.cpp @@ -376,7 +376,7 @@ void VertexProgramDecompiler::SetDSTSca(const std::string& code) std::string VertexProgramDecompiler::NotZeroPositive(const std::string& code) { - return "max(" + code + ", 1.E-10)"; + return "max(" + code + ", 0.000001)"; } std::string VertexProgramDecompiler::BuildFuncBody(const FuncInfo& func)