Skip to content

Small fixes from Fritchii v5: fastmem on low-memory PCs, channel deadlock, guest memory reserve (on) - #53

Merged
Spikol02 merged 8 commits into
mainfrom
claude/amazing-galileo-4w6g4w-lichii-fixes
Nov 9, 2026
Merged

Spikol02 merged 8 commits into
mainfrom
claude/amazing-galileo-4w6g4w-lichii-fixes

Conversation

@Spikol02

@Spikol02 Spikol02 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Fixes the Fritchii v5 release lists that Nyamu was missing.

Built (video_core, core, Qt app) and tested together with all open PRs: 731 of 733 tests pass and 1 is skipped (the one failure is the usual libopus check). The Windows-only parts of host_memory.cpp couldn't be compiled here, so please check your local Windows build.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WzPMHjWo2FbkicE8Ky2Vda

Frysix and others added 8 commits November 9, 2026 03:46
…g fastmem (#645)

* common: retry the Windows fastmem backing allocation instead of losing fastmem

HostMemory charges the whole backing (14 GiB for Switch 2 programs) to the
commit limit with one SEC_COMMIT CreateFileMapping2. When the free commit is
only just above that size, the call fails with ERROR_NO_SYSTEM_RESOURCES and a
system-managed page file is not grown. HostMemory then falls back to a plain
VirtualAlloc of the same size, which does grow the page file and succeeds, but
the session runs without fastmem: every guest memory access goes through the
page table. On Ocarina of Time that costs 20-25% of the frame rate for the
whole session.

On a failure, commit the same size privately once (this grows the page file),
release it and try the section again, up to five times. Each failure is
logged with the error code and the free commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* common: wait before each fastmem backing retry, not after the last attempt

Review feedback on #645: sleep after failed attempts 1-4 so the first retry also
gets time for the page file to grow, and fall back without a pointless wait after
the final attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…omb red line, port of #722) (#820)

* shader: interpolate noperspective varyings perspective-correct (#441)

Ocarina of Time draws water volumes whose vertex shader writes a
screen-space coordinate (clip.xy / clip.w) as a noperspective varying.
When a vertex sits next to or behind the camera (w close to 0), the
primitive is clipped and the attribute has to be re-interpolated at the
clip points. On AMD (RDNA3, Windows driver) that produces wrong values:
the fragment shader samples its depth input far off, computes a negative
distance and exp2 overflows to the R11G11B10 maximum. This is the red
dotted line in the Royal Family's Tomb.

Emulate noperspective with perspective interpolation instead: the last
pre-rasterization stage (vertex, tessellation evaluation or geometry)
writes the value times Position.w, and the fragment stage reads it
perspective-correct and multiplies by FragCoord.w (1/w). The result is
the same screen-linear value, and clipping now interpolates it correctly.

Mesh pipelines are left unchanged: the fragment stage only converts its
inputs when the previous stage scaled them. EDEN_NX2_NOPERSP_AS_SMOOTH=0
turns the emulation off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* shader: keep noperspective emulation out of XFB, indexed loads and repeated EmitVertex

Review follow-ups for the perspective-correct noperspective emulation:

- Skip the emulation when transform feedback is enabled or the fragment
  program reads attributes indexed. Transform feedback would capture the
  value times Position.w, and the indexed load path does not multiply by
  FragCoord.w. Producer and fragment stage decide together, so those
  pipelines keep native noperspective interpolation.
- Geometry shaders keep output values across EmitVertex. An output that
  is written once and emitted several times was scaled by every vertex's
  w in turn. Restore the unscaled values after each EmitVertex, like the
  fixed pipeline point size.
- Assert instead of silently skipping the FragCoord.w multiply; only
  float inputs are marked and DefineInputs forces FragCoord for them.
- Wrap three lines to the 100-column limit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* shader: always interpolate noperspective varyings perspective-correct

Drop the EDEN_NX2_NOPERSP_AS_SMOOTH switch from #722 so the fix ships
unconditionally.

* shader: keep native noperspective varyings with passthrough geometry

A passthrough geometry shader can write generics outside its passthrough
mask, and those aren't scaled by Position.w, so the fragment stage must not
divide them.

---------

Co-authored-by: justin-wq1337 <352978534+justin-wq1337@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…) (#609)

ib_enable, dma_increment_once, signal_sync and synced were 1-bit fields in
one byte. The fence callback sets synced on the fence thread, and a bitfield
store rewrites the whole byte, so it could write back a stale
dma_increment_once = true after the GPU thread cleared it. The next
Increasing header then ran non-incrementing, its SET_REPORT_SEMAPHORE query
word was never written, and the channel deadlocked on its own acquire.

Make them separate fields and synced a std::atomic<bool>.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Log2Floor(0) wraps to 0xFFFFFFFF, so Log2Ceil(0) shifted by that much and
returned a huge index. A zero-size staging request (the null image's upload
in the crash #910 fixed) then read StagingBufferPool's 64-entry cache far out
of range. Log2Ceil now returns 0 for 0.

Refs #904, #910
…reserved, committed on use (Windows, off by default)

SEC_COMMIT charged the whole 14 GiB section against the commit limit at boot (41 GB of commit
on the owner's PC with 5 GB of it resident), which on a 16 GB PC with a small pagefile can fail
allocations. With the switch the section is SEC_RESERVE and its 64 KiB granules are committed
through the backing view as the kernel hands pages out: MarkUsed (so ClearBackingRegion too),
Map, the INI range, and at kernel init everything outside the user pools (slab heaps, page
table heap, pool management), before the slab heaps are set up. Commit never goes back down.

A first vectored handler is the safety net: a fault on a reserved page of the backing or
virtual view (a missed commit) commits the 64 KiB around it and retries, instead of dynarmic
taking it for a fastmem miss and moving the instruction to the slow path for good. The memory
log line prints the section's commit and that handler's count, which must stay 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fritchii v5.1 rolled it back (9b30eec8ca): noperspective varyings emulated as perspective times
Position.w turned the fog volume at the Hyrule Field drawbridge solid white on an RTX 4080 and
drew rare lines in Kokiri Forest fog, and it is suspected in an RX 6600 boot crash on a cached
tessellation pipeline. The AMD tomb line stays until a fix is tested on AMD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzPMHjWo2FbkicE8Ky2Vda
Fritchii v5 (b59b8a860d) and CheezerWheezer's AMD Superior build 9 (ab795780d4) ship it on:
committing the whole 14 GiB guest section at boot left 16 GB PCs out of commit (Windows error
1455) loading a save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzPMHjWo2FbkicE8Ky2Vda
@Spikol02 Spikol02 changed the title Small fixes from Fritchii v5: fastmem on low-memory PCs, tomb red line, channel deadlock, guest memory reserve Small fixes from Fritchii v5: fastmem on low-memory PCs, channel deadlock, guest memory reserve (on) Nov 9, 2026
@Spikol02
Spikol02 merged commit 52054ab into main Nov 9, 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.

6 participants