diff --git a/ShaderRecomp/shader_recompiler.cpp b/ShaderRecomp/shader_recompiler.cpp index 7169cc0..79b537b 100644 --- a/ShaderRecomp/shader_recompiler.cpp +++ b/ShaderRecomp/shader_recompiler.cpp @@ -245,11 +245,14 @@ void ShaderRecompiler::recompile(const TextureFetchInstruction& instr, bool bicu std::string constName; const char* constNamePtr = nullptr; + bool subtractFromOne = false; auto findResult = samplers.find(instr.constIndex); if (findResult != samplers.end()) { constNamePtr = findResult->second; + subtractFromOne = strcmp(constNamePtr, "sampZBuffer") == 0 || + strcmp(constNamePtr, "g_DepthSampler") == 0; } else { @@ -273,12 +276,18 @@ void ShaderRecompiler::recompile(const TextureFetchInstruction& instr, bool bicu switch (instr.opcode) { case FetchOpcode::TextureFetch: + { + if (subtractFromOne) + out += "1.0 - "; out += "tfetch"; break; + } case FetchOpcode::GetTextureWeights: + { out += "getWeights"; break; } + } std::string_view dimension; uint32_t componentCount = 0;