From a34944e4d2abf88269caef7bf1cf881431832957 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sat, 28 Oct 2023 10:28:25 +0200 Subject: [PATCH] [GPU] Added hack for AC6 floor/ground. Thanks Blackbird88 & TTFH3500 Added to prevent further builds fragmentation. This will stay until accurate RCP will be implemented. --- src/xenia/gpu/dxbc_shader_translator_fetch.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/dxbc_shader_translator_fetch.cc b/src/xenia/gpu/dxbc_shader_translator_fetch.cc index 7716c4a26..3c345778b 100644 --- a/src/xenia/gpu/dxbc_shader_translator_fetch.cc +++ b/src/xenia/gpu/dxbc_shader_translator_fetch.cc @@ -19,6 +19,12 @@ #include "xenia/gpu/dxbc_shader_translator.h" #include "xenia/gpu/render_target_cache.h" +DEFINE_bool( + ac6_ground_fix, false, + "This fixes(hide) issues with black ground in AC6. Use only in AC6. " + "Might cause issues in other titles.", + "HACKS"); + namespace xe { namespace gpu { using namespace ucode; @@ -85,7 +91,14 @@ void DxbcShaderTranslator::ProcessVertexFetchInstruction( a_.OpAdd(address_dest, index_operand, dxbc::Src::LF(0.5f)); a_.OpRoundNI(address_dest, address_src); } else { - a_.OpRoundNI(address_dest, index_operand); + // UGLY HACK. Remove ASAP. + // Proper fix requires accurate RCP implementation. + if (cvars::ac6_ground_fix) { + a_.OpAdd(address_dest, index_operand, dxbc::Src::LF(0.00025f)); + a_.OpRoundNI(address_dest, address_src); + } else { + a_.OpRoundNI(address_dest, index_operand); + } } if (index_operand_temp_pushed) { PopSystemTemp();