Port two Lichii shader recompiler fixes (#433 dynamic PTP gathers, #588 TXD/ATOMG register fields) #566

Merged
R0mulus001 merged 2 commits from lichii-433-dynamic-ptp into main 2026-11-08 16:49:22 +00:00
R0mulus001 commented 2026-11-08 11:25:37 +00:00 (Migrated from github.com)

Two small fixes ported from zortos293/Lichii; Hookshot's copies of both files matched Lichii's pre-fix code, so they apply as is.

  1. Dynamic PTP gathers (Lichii c11ea2f0d, PR 433, originally Duck912 1e02498099)
    A TLD4.PTP whose offsets the IR can't fold to constants was emitted as a plain gather ("Not all arguments in PTP are immediate, ignoring"), so all four taps read at the coordinate instead of at their own offsets. Such gathers now issue one gather per tap with its runtime Offset and keep its i0,j0 texel (w). Constant-offset and sparse gathers are unchanged.
    File: backend/spirv/emit_spirv_image.cpp

  2. TXD gradients and ATOMG data as register fields (Lichii 33acb0e1a, PR 588)
    A native TXD whose gradients (bits 32-39) or an ATOMG whose data operand (bits 32-39) sits in a reserved high GPR read the plain register, because bit 32 counted as a register field only for the listed opcodes. 0xb6c and 0x9a8 are added to that list.
    File: frontend/ampere/lower_to_maxwell.h

Testing: built with HookshotBuilder (no-visual-studio release) and played Kokiri Forest / Lost Woods for a few sessions on an RTX 3080 Laptop (Vulkan 1.4). No regressions seen. I haven't isolated a scene where either fix makes a visible difference yet.

Two small fixes ported from zortos293/Lichii; Hookshot's copies of both files matched Lichii's pre-fix code, so they apply as is. 1. Dynamic PTP gathers (Lichii c11ea2f0d, PR 433, originally Duck912 1e02498099) A TLD4.PTP whose offsets the IR can't fold to constants was emitted as a plain gather ("Not all arguments in PTP are immediate, ignoring"), so all four taps read at the coordinate instead of at their own offsets. Such gathers now issue one gather per tap with its runtime Offset and keep its i0,j0 texel (w). Constant-offset and sparse gathers are unchanged. File: backend/spirv/emit_spirv_image.cpp 2. TXD gradients and ATOMG data as register fields (Lichii 33acb0e1a, PR 588) A native TXD whose gradients (bits 32-39) or an ATOMG whose data operand (bits 32-39) sits in a reserved high GPR read the plain register, because bit 32 counted as a register field only for the listed opcodes. 0xb6c and 0x9a8 are added to that list. File: frontend/ampere/lower_to_maxwell.h Testing: built with HookshotBuilder (no-visual-studio release) and played Kokiri Forest / Lost Woods for a few sessions on an RTX 3080 Laptop (Vulkan 1.4). No regressions seen. I haven't isolated a scene where either fix makes a visible difference yet.
Commenting is not possible because the repository is archived.
No description provided.