Skip to content

fix(shaders): R2UR's source is one register, not a pair (a vertex program refused) - #1806

Merged
hckrman101 merged 1 commit into
NotRexed:mainfrom
Joey-Magnus:fix/lower-r2ur-one-register
Nov 10, 2026
Merged

hckrman101 merged 1 commit into
NotRexed:mainfrom
Joey-Magnus:fix/lower-r2ur-one-register

Conversation

@Joey-Magnus

Copy link
Copy Markdown
Contributor

One of OoT's vertex programs (65dd5ce0adbe3b64) fails to translate ("native program uses lowering scratch registers") at an R2UR that reads R238. Nothing in it uses a scratch register: the lowering assumes R2UR's source may be a register pair.

Cause. R2UR UR6, R238 (ee0673c2 00000000 000e0000 000e2200). With the uniform bank in use, R238 is a high GPR. FieldSpan has no entry for R2UR, so the source's span came from its alignment: an even register, R4n+2, is taken as a pair, R238-R239. R239 is the lowering's own scratch, and R2UR lowers to eight words that use it, so that's a conflict. R2UR reads one 32-bit register.

Change (lower_to_maxwell.h, FieldSpan): R2UR's source spans one register, as MUFU's and CS2R's entries do for theirs.

Tests

🤖 Generated with Claude Code

@Joey-Magnus

Copy link
Copy Markdown
Contributor Author

Thanks, you're right about R236: it's 4-aligned, so main took it for the quad R236-R239 and refused it too. The test now calls it a second case this fixes, and checks that R2UR UR6, R239 is still refused (R239 itself is the scratch). Rebased onto main (the run_all.py conflict); run_all.py passes apart from nx2/test_nup_stand_in.py, which #1790 fixes.

@Joey-Magnus
Joey-Magnus force-pushed the fix/lower-r2ur-one-register branch from 00174b0 to a58afce Compare November 10, 2026 17:48
One of OoT's vertex programs was refused as "native program uses lowering scratch
registers" at R2UR UR6, R238: with no span known for R2UR's source, its alignment made it
the pair R238-R239, and R239 is the lowering's own scratch, used by R2UR's eight words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Joey-Magnus
Joey-Magnus force-pushed the fix/lower-r2ur-one-register branch from a58afce to 597edcb Compare November 10, 2026 18:00
@hckrman101
hckrman101 merged commit 9edb3a5 into NotRexed:main Nov 10, 2026
6 of 8 checks passed
Joey-Magnus pushed a commit to Joey-Magnus/Hookshot that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant