Translate float atomic adds, signed RED offsets, calls and subgroup operations correctly.

Patch 0023 turns a global RED or ATOM .F32 add, which the translator dropped, into a compare-and-swap loop with a float
add once GlobalToStorage knows its buffer; the light and fog accumulators of Ocarina use them, and their loss lit
Kokiri Forest's fog as if nothing shaded it. Patch 0024 reads RED's 20-bit offset as signed, as ATOM already did.
Patch 0025 keeps the block after a CAL as its successor, so code after a call is no longer dropped. Patch 0026 keeps
ballot, shuffle and vote operations where they are, so they see every lane. build_xlate.py now expects 25 patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-06 21:43:49 -05:00
parent 12fbb31451
commit 85f401669f
5 changed files with 98 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
--- a/src/Ryujinx.Graphics.Shader/StructuredIr/AstOptimizer.cs
+++ b/src/Ryujinx.Graphics.Shader/StructuredIr/AstOptimizer.cs
@@ -69,6 +69,16 @@
case Instruction.AtomicXor:
case Instruction.Call:
case Instruction.ImageAtomic:
+ // NX2NAVI: a subgroup operation reads the other lanes, so it must stay where it was: moved into a
+ // branch it sees only the lanes that took the branch (Ocarina's culling counted 1 of 32)
+ case Instruction.Ballot:
+ case Instruction.Shuffle:
+ case Instruction.ShuffleDown:
+ case Instruction.ShuffleUp:
+ case Instruction.ShuffleXor:
+ case Instruction.VoteAll:
+ case Instruction.VoteAllEqual:
+ case Instruction.VoteAny:
return true;
}
}