Sample terrain with the right mip levels, keep NaNs out of min, max and clamp, and give shadow gathers their own tap offsets.

The runtime's TXD gradient transpose (gfx_shader.c patch_txd_transpose) is off for Switch 2 titles: the SM86 lowering
already orders the interleaved derivatives for the translator, so transposing again swapped them back. The
translator's float min, max and clamp are the NaN-safe forms (patch 0031), as Maxwell FMNMX and saturate behave, so a
NaN no longer spreads through lighting and bloom on drivers that pass it on. Depth-compare gathers with per-tap offsets
are split into one gather per tap like the others (patch 0032), where all four taps took the first tap's offset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-07 16:28:52 -05:00
parent 501d5bd084
commit 37c06e6894
5 changed files with 48 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
--- a/src/Ryujinx.Graphics.Shader/Translation/Transforms/TexturePass.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/Transforms/TexturePass.cs
@@ -431,7 +431,10 @@
LinkedListNode<INode> oldNode = node;
- if (isGather && !isShadow && hasOffsets)
+ // NX2NAVI: depth-compare gathers too. With per-tap offsets (TLD4.PTP) the else branch below adds only tap 0's
+ // offset, so a shadow map's four taps all came from one place (blocky shadow edges); one gather per tap with
+ // that tap's offset keeps its compared texel, the reference value staying in the copied sources.
+ if (isGather && hasOffsets)
{
Operand[] newSources = new Operand[sources.Length];