shader: LDS bounds on by default, NaN scrub and HDR clamp as options (upstream 42a334d, b85c30b, 34dcb01) #80

Open
github-bot wants to merge 4 commits from github-bot/gh-80 into main AGit
Owner

@⁠Kal0s-design on GitHub · 2026-12-05 22:59 UTC · original
Kal0s-design:port/lds-bounds → main · +381 −15 · 10 files · 4 commits · open

Three translator passes from upstream ReVIctory (42a334d, b85c30b, 34dcb01, authors kept), plus a version bump of my own.

LDS bounds is the one that matters by default. The console reads 0 outside a program's shared memory and drops writes there, while on the host group-shared memory past the program's size is undefined and holds the translator's own exchange and counter dwords. The lowering took every address as inside. Now a place past the title's SharedMemorySizeInDW reads 0, its writes and atomics are left out, and an atomic outside returns 0. The upstream message names the cloud pass's tile sort as a case, where 31 of 32 groups clear and read far behind their 2.5 KiB. It is on by default as upstream has it, and VICTORY_LDS_BOUNDS=0 goes back to the old behaviour.

NaN scrub (VICTORY_NAN_SCRUB) and HDR clamp (VICTORY_HDR_CLAMP) are off by default, so they change nothing unless set. They are there for anyone chasing black blobs, glitter or white spikes from 16-bit float targets. Each adds itself to the shader cache key only when set, so default keys stay as they were.

The bump. LDS bounds changes the default translation of every shader that touches LDS, but the cache only keys on it when it is off, so without a bump the cache would hand back translations made without the bounds. Upstream didn't bump for it. TRANSLATOR_VERSION goes from 20 to 21 here, which means one more retranslation after #65's.

On top of main as of #67, clippy -D warnings is clean in both of the Lint workflow's runs, and victory-shader passes apart from two tests that fail the same way on main without these commits (single_instructions_give_what_rdna2_gives and the float-view d16 one explained in #65). victory-gpu's shader_cache tests pass. Since then main only gained launcher changes, and the branch is rebased on it. I haven't seen the difference in game.

AI-assisted: yes

🤖 Generated with Claude Code

**@⁠Kal0s-design** on GitHub · 2026-12-05 22:59 UTC · [original](https://github.com/VGLALALA/ReVictory-RDNA3/pull/80) `Kal0s-design:port/lds-bounds` → `main` · +381 −15 · 10 files · 4 commits · open Three translator passes from upstream ReVIctory (42a334d, b85c30b, 34dcb01, authors kept), plus a version bump of my own. LDS bounds is the one that matters by default. The console reads 0 outside a program's shared memory and drops writes there, while on the host group-shared memory past the program's size is undefined and holds the translator's own exchange and counter dwords. The lowering took every address as inside. Now a place past the title's SharedMemorySizeInDW reads 0, its writes and atomics are left out, and an atomic outside returns 0. The upstream message names the cloud pass's tile sort as a case, where 31 of 32 groups clear and read far behind their 2.5 KiB. It is on by default as upstream has it, and VICTORY_LDS_BOUNDS=0 goes back to the old behaviour. NaN scrub (VICTORY_NAN_SCRUB) and HDR clamp (VICTORY_HDR_CLAMP) are off by default, so they change nothing unless set. They are there for anyone chasing black blobs, glitter or white spikes from 16-bit float targets. Each adds itself to the shader cache key only when set, so default keys stay as they were. The bump. LDS bounds changes the default translation of every shader that touches LDS, but the cache only keys on it when it is off, so without a bump the cache would hand back translations made without the bounds. Upstream didn't bump for it. TRANSLATOR_VERSION goes from 20 to 21 here, which means one more retranslation after #65's. On top of main as of #67, clippy -D warnings is clean in both of the Lint workflow's runs, and victory-shader passes apart from two tests that fail the same way on main without these commits (single_instructions_give_what_rdna2_gives and the float-view d16 one explained in #65). victory-gpu's shader_cache tests pass. Since then main only gained launcher changes, and the branch is rebased on it. I haven't seen the difference in game. AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Default off. `1` scrubs pixel colour outputs and 32-bit image stores: a
value known to be a float (or a known float bit pattern) becomes 0.0 where
it is a NaN; stores keep infinities as written so volumetric and distance
sentinels still work. `2` scrubs every 32-bit store as a float.
VICTORY_NAN_SCRUB_INF=0 zeroes infinities on pixel outputs instead of
holding them at 65504, VICTORY_NAN_SCRUB_STORE_INF=0 clamps them in stores,
and VICTORY_NAN_EXACT=0 classifies with fcmp instead of integer bit tests.

Ported from the foxhound family's translator pass (MiniVI
crates/victory-shader/src/emit/hdr.rs), itself from the GPL-3.0 patches by
voidopcode/vilocity, felicienradio/cold-project-vi and aki-runtime.
With VICTORY_HDR_CLAMP set to anything but 0, every pixel float colour
output is held to the console's [-65024, 65024] and its NaN becomes 0.0.
A value beyond the largest finite 16-bit float (65504) becomes +Inf in a
16-bit float host target, which tonemapping turns into black blobs or
glitter, and a NaN into a white spike.

Off by default here so translations are unchanged unless asked for (the
fork this comes from has it on by default); wired where the pixel colour
outputs are stored, half outputs included. Ported from MiniVI's
crates/victory-shader/src/emit/hdr.rs.
Outside a program's shared memory the console reads 0 and drops writes;
group-shared memory of the host is undefined there, and behind the
program's dwords lie ours. The lowering took every address as inside.
Now the dword's place is compared with the title's header size
(SharedMemorySizeInDW, kept aside before the lowering adds its own
exchange/counter dwords), a place outside is read as 0 and its writes
and atomics are left out, and an atomic outside returns 0 like a read.
Default on, as in the fork this comes from; VICTORY_LDS_BOUNDS=0 takes
every address as inside, as before.

Seen in the cloud pass's tile sort: a counting sort over 256 bins in LDS,
the bin a thread clears and reads addressed by its number in the whole
dispatch, so 31 of the 32 groups clear and read up to 32 KiB behind their
2.5 KiB.

Ported from foxhound's VICTORY_LDS_BOUNDS.
VICTORY_LDS_BOUNDS is on unless set to 0, so the default translation of
every shader that touches LDS changes. The shader cache only adds the
setting to its key when it is off, which keeps the default key as it was,
so without a bump the cache would hand back translations made without the
bounds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 23:07:45 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/80/head:github-bot/gh-80'
git switch 'github-bot/gh-80'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-80'
git switch 'github-bot/gh-80'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-80'
git switch 'github-bot/gh-80'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-80'
git switch 'main'
git merge --squash 'github-bot/gh-80'
git switch 'main'
git merge --ff-only 'github-bot/gh-80'
git switch 'main'
git merge 'github-bot/gh-80'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.