Repository navigation
Conversation
…ariant with no curve and no power is drawn as one colour space: Ocarina of Time's upscaler is MetalFX's Ocarina of Time (Switch 2) upscales 1536x864 to 2048x1152 with agl_ndsr_vr.pck's network (f8965bffbdf51d78 and others). game.py listed only agl_ndsr.pck's shaders, so the MetalFX option left it running; listed, its variants were refused, as their code holds no sRGB curve (R11G11B10F in and out). A variant with no curve constant and no MUFU.EX2 / MUFU.LG2 (which every curve takes, wherever its constants come from) neither encodes nor decodes, and is drawn as the linear shape, which converts nothing either. With MetalFX in its place, the dotted horizontal lines the network's output showed in fog and light shafts are gone. Tests: t_upscaler_mfx (Bananza's and Splatoon Raiders' profiles, game and metalfx, both encoding modes): no curve and no power -> one colour space; a power with no curve constant -> the shader runs; a MUFU that is no power does not count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…MetalFX option draws its agl_ndsr_vr.pck upscale (main's dead-code fix removed the dotted lines at their source) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the scaler (Ocarina of Time no longer washed out) agl_ndsr_vr.pck's networks read the scene colour square-root encoded and write its square (an HMUL2 x * |x|). With no curve and no power they were drawn as the linear shape, so MetalFX passed the encoded colour through. up_mfx_has_sq finds the square in the code; such a variant is squared into the scaler's RGBA16F input (copy_t2t_draw COPY_T2T_SQUARE, copy.metal fssq), then scaled in HDR mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dinadur
marked this pull request as ready for review
November 6, 2026 20:14
Author
|
Closing this as superseded: @PromethOps found the same cause independently and fixed it in #1459 (d715366). That fix also covers the FMUL form in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #1459 (its two commits are the base of this branch; only the last commit, c64c6e8, is this change). Once #1459 merges, this PR shows the one commit.
What and why
With #1459,
DM_UPSCALER=metalfxdraws The Legend of Zelda: Ocarina of Time'sagl_ndsr_vr.pck/agl_ndsr_vr_light.pckupscale, classifying every variant as the no-curve linear shape. In play the picture came out washed out: pale, low contrast and foggy across the whole scene, with the UI drawn after it correct (reported in #1459 (comment)).Cause: these networks keep their picture square-root encoded. The variants that write the picture compute
c * |c|of the sampled input plus the network's residual: in the translated MSL offa3033d05c0a41d6, the output is(sample + residual) * abs(sample + residual)(63 such products), and the input is RGB9E5 holding the encoded colour. Drawn as the linear shape, MetalFX passed the encoded colour through, so the output wassqrtof the colour. The square is a plainHMUL2with|Rb|, with noMUFUand no constant, so the curve and power checks cannot see it.Change:
up_mfx_has_sqcountsHMUL2in register form (0x232in the low 12 bits) with both sources one register (notRZ) and|Rb|(bit 62), from 8, as the curve constants are counted. Ocarina of Time's four picture-writing variants (fa3033d05c0a41d6,aad7ea7e5c02f41d,b106afba1a18faa9,04135bb812a0d66e) have 32 to 36 each in the raw code. The passes beside them (f8965bffbdf51d78,d17eefaff4f0bc23,a335c1db6270c355) have none.UP_COLOR_SQ. It is drawn through the scaler's RGBA16F input, never straight, with the input squared on the way in (copy_t2t_drawwith a host-onlyCOPY_T2T_SQUAREflag, which the guest's copy flags are masked against, andcopy.metal'sfssq). MetalFX then runs in HDR mode, as for linear colour.docs/reference/rendering.md's An upscaler's colour read from its code.Checked
make -C dm/gfx/tests GAME=0400486024DEC000 t_upscaler_mfx, run ascheck_t_upscaler_mfxruns it (DM_NVN_ENC_THREAD=0and1withDM_UPSCALER=metalfx: 107 checks; without: 21; andMTL_DEBUG_LAYER=1), all passing. New checks:UP_COLOR_SQ;x * xwithout|x|, two registers, andRZ→ linear;0400486024DEC000, update v131072, Mac app, both MetalFX options on. Played in Kokiri Forest and inside the Great Deku Tree.upscaler fa3033d05c0a41d6_b: square-root-encoded input, linear output … squared before MetalFX in HDR modeandfirst dispatch of fa3033d05c0a41d6_b drawn by MetalFX, 1536x864 … (format 93) → 2048x1152 … (format 92), through RGBA16F, squared from its square-root encoding.d99fbeeb53d38847,7c511cc23ff85d14) were classified the same way.f8965bffbdf51d78,d17eefaff4f0bc23anda335c1db6270c355stayed linear.scripts/regress.py check --games; Donkey Kong Bananza and Splatoon Raiders in play (not owned; their classification cannot change, see above); iOS; Mario Kart World's variants.Docs
docs/reference/rendering.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index; no change)🤖 Generated with Claude Code