Every write to an 8 KiB page of GS memory (a draw into a render target, a
transfer, a CPU write) gives it a new version; GS memory and each render
target know the versions they hold. Before GS memory is read (a texture in
another format or width than the target's, a transfer, a CLUT, a buffer
displayed from memory) the target holding a page's newest version writes it
there, page by page on the GPU copy; before a target is drawn into or sampled,
its older pages are reloaded from GS memory. This replaces ensureCoherent,
fillTargetFromMemory, resolveTargetsUnder and dropTargetsUnder: targets are no
longer dropped under uploads, and targets sharing memory in different formats
or widths see each other's pixels as the GS would (VP2's CT16 / CT32 views of
its post-process buffer and the blur levels inside its pages: the colour bands
along the bottom and right edges are gone).
FBMSK keeping part of a channel (VP2 writes CT16 bits 14-15 alone with 0x3FFF
to move a channel into CT32's alpha, SCTPT2 the top alpha bit with
0x7F000000): the kept bits come from a copy of the target when the batch does
not blend; in CT16 only the stored bits count (a channel whose stored bits
are all kept is masked whole). A CT16 reload keeps the stored alpha bit.
A read straight from a target now needs its width too; a colour target used
as Z (depthFromColorTarget) has its pages brought up to date first.
PS2X_GS_NATIVE_STOPDRAW=<n> (diagnostics) draws only the first n batches.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Opt-in per game, default path unchanged. A game that runs its own loop on real time:
- FramePacer (runtime/frame_pacer.h, PS2Runtime::framePacer): frameEnd() holds the frame to the cap (PS2X_FRAME_CAP,
default 60, 0 = unlimited, settable at run time) and returns the frame's real duration;
- EeScheduler::setNativeFrames(true): the game's frame end shows the picture (presentGuestFrame) instead of vblanks,
and due events fire once EE time reaches them, without waiting for their host deadline (the game keeps EE time on
real time at its frame end); the latch code moves to latchGuestFrame();
- the host window follows the cap and uploads one picture per frame the game ends.
docs/native.md: goal, layers (frame loop, audio on wall time, translating renderer, hardware waits, native VU
output), layer 1 API. First user VP2S (VP2S_NATIVE=1): first field scene at cap 60, ~44 distinct frames/s, 48
presented/s, host never idle.
Co-Authored-By: Claude Opus 5.5 <[email protected]>