aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDuck912 <350528965+Duck912@users.noreply.github.com>2026-11-01 21:41:22 -0500
committerDuck912 <350528965+Duck912@users.noreply.github.com>2026-11-01 21:54:48 -0500
commitef3ae4ae23b2148fac5b7b335c001b2802a9222b (patch)
tree52f8c2277872cc165c4da90a7d21bd15e5e2f26e /src
parent43ab1ee42c70b073a839c2675fa33b210f2d8b46 (diff)
shader: apply FSEL's floating operand modifiers
FSEL dropped the negate and absolute value modifiers of its sources. Fire Emblem: Fortune's Weave's sky vertex shader builds its cube corners with FSEL R, -1.0 forms: every corner came out +1.0, the cube collapsed to one point and the sky was flat. SEL (integer) is unchanged. Assisted-by: Claude Opus 5.5 (debugging, implementation and drafting) Signed-off-by: Duck912 <350528965+Duck912@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/frontend/ampere/lower_to_maxwell.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shader_recompiler/frontend/ampere/lower_to_maxwell.h b/src/shader_recompiler/frontend/ampere/lower_to_maxwell.h
index 7bc8388192..79f98017ae 100644
--- a/src/shader_recompiler/frontend/ampere/lower_to_maxwell.h
+++ b/src/shader_recompiler/frontend/ampere/lower_to_maxwell.h
@@ -2084,7 +2084,9 @@ inline LoweredProgram LowerToMaxwell(std::span<const Instruction> code) {
}
case 0x207: case 0x807: case 0xa07:
case 0x208: case 0x808: case 0xa08: { // Bitwise SEL / FSEL
- const u32 a = operand(0, false), b = operand(1, false);
+ // FSEL applies the floating operand modifiers (negate/absolute) before selecting.
+ const bool floating = (opcode & 0x1ff) == 0x008;
+ const u32 a = operand(0, floating), b = operand(1, floating);
emit(base(0x5ca0000000000000ULL) | (u64{a} << 8) | (u64{b} << 20) |
(u64{insn.Bits(87, 3)} << 39) | (u64{insn.Bits(90, 1)} << 42));
break;