From 2efa88dbd42b05c4f6e0930c07f4709a9b29bf5b Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sun, 16 Mar 2025 14:37:39 -0400 Subject: [PATCH] Generator changes Signed-off-by: Isaac Marovitz --- XenosRecomp/shader_recompiler.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/XenosRecomp/shader_recompiler.cpp b/XenosRecomp/shader_recompiler.cpp index 78a1eb3..409eb1a 100644 --- a/XenosRecomp/shader_recompiler.cpp +++ b/XenosRecomp/shader_recompiler.cpp @@ -556,22 +556,38 @@ void ShaderRecompiler::recompile(const AluInstruction& instr) { case AluVectorOpcode::KillEq: indent(); +#ifdef XENOS_RECOMP_AIR + println("if (any({} == {})) discard_fragment();", op(VECTOR_0), op(VECTOR_1)); +#else println("clip(any({} == {}) ? -1 : 1);", op(VECTOR_0), op(VECTOR_1)); +#endif break; case AluVectorOpcode::KillGt: indent(); +#ifdef XENOS_RECOMP_AIR + println("if (any({} > {})) discard_fragment();", op(VECTOR_0), op(VECTOR_1)); +#else println("clip(any({} > {}) ? -1 : 1);", op(VECTOR_0), op(VECTOR_1)); +#endif break; case AluVectorOpcode::KillGe: indent(); +#ifdef XENOS_RECOMP_AIR + println("if (any({} >= {})) discard_fragment();", op(VECTOR_0), op(VECTOR_1)); +#else println("clip(any({} >= {}) ? -1 : 1);", op(VECTOR_0), op(VECTOR_1)); +#endif break; case AluVectorOpcode::KillNe: indent(); +#ifdef XENOS_RECOMP_AIR + println("if (any({} != {})) discard_fragment();", op(VECTOR_0), op(VECTOR_1)); +#else println("clip(any({} != {}) ? -1 : 1);", op(VECTOR_0), op(VECTOR_1)); +#endif break; } @@ -727,7 +743,11 @@ void ShaderRecompiler::recompile(const AluInstruction& instr) break; case AluVectorOpcode::Frc: +#ifdef XENOS_RECOMP_AIR + print("fract({})", op(VECTOR_0)); +#else print("frac({})", op(VECTOR_0)); +#endif break; case AluVectorOpcode::Trunc: @@ -795,7 +815,11 @@ void ShaderRecompiler::recompile(const AluInstruction& instr) break; case AluVectorOpcode::Dst: +#ifdef XENOS_RECOMP_AIR + print("distance({}, {})", op(VECTOR_0), op(VECTOR_1)); +#else print("dst({}, {})", op(VECTOR_0), op(VECTOR_1)); +#endif break; } @@ -901,7 +925,11 @@ void ShaderRecompiler::recompile(const AluInstruction& instr) break; case AluScalarOpcode::Frcs: +#ifdef XENOS_RECOMP_AIR + print("fract({})", op(SCALAR_0)); +#else print("frac({})", op(SCALAR_0)); +#endif break; case AluScalarOpcode::Truncs: