More generator changes

Signed-off-by: Isaac Marovitz <isaacryu@icloud.com>
This commit is contained in:
Isaac Marovitz 2025-03-16 14:46:39 -04:00
parent 2efa88dbd4
commit a223077258
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1

View file

@ -952,7 +952,11 @@ void ShaderRecompiler::recompile(const AluInstruction& instr)
case AluScalarOpcode::Rcpc:
case AluScalarOpcode::Rcpf:
case AluScalarOpcode::Rcp:
#ifdef XENOS_RECOMP_AIR
print("clamp((1.0 / {}), FLT_MIN, FLT_MAX)", op(SCALAR_0));
#else
print("clamp(rcp({}), FLT_MIN, FLT_MAX)", op(SCALAR_0));
#endif
break;
case AluScalarOpcode::Rsqc:
@ -1108,7 +1112,11 @@ void ShaderRecompiler::recompile(const AluInstruction& instr)
if (instr.scalarOpcode >= AluScalarOpcode::KillsEq && instr.scalarOpcode <= AluScalarOpcode::KillsOne)
{
indent();
#ifdef XENOS_RECOMP_AIR
out += "if (ps != 0.0) discard_fragment();\n";
#else
out += "clip(ps != 0.0 ? -1 : 1);\n";
#endif
}
if (closeIfBracket)
@ -1674,7 +1682,9 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi
{
indent();
#ifdef UNLEASHED_RECOMP
#ifndef XENOS_RECOMP_AIR
print("[unroll] ");
#endif
#endif
println("for (aL = 0; aL < i{}.x; aL++)", uint32_t(cfInstr.loopStart.loopId));
indent();
@ -1827,12 +1837,22 @@ void ShaderRecompiler::recompile(const uint8_t* shaderData, const std::string_vi
specConstantsMask |= SPEC_CONSTANT_ALPHA_TEST;
indent();
out += "[branch] if (g_SpecConstants() & SPEC_CONSTANT_ALPHA_TEST)";
#ifndef XENOS_RECOMP_AIR
out += "[branch] ";
#endif
out += "if (g_SpecConstants() & SPEC_CONSTANT_ALPHA_TEST)";
indent();
out += '{';
indent();
#ifdef XENOS_RECOMP_AIR
out += "\tif ((oC0.w - g_AlphaThreshold) < 0.0) discard_fragment();\n";
#else
out += "\tclip(oC0.w - g_AlphaThreshold);\n";
#endif
indent();
out += "}";