Implement reverse Z negation.

This commit is contained in:
Skyth 2024-11-08 20:16:24 +03:00
parent fce786210a
commit b7c0372246

View file

@ -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;