Files
retroDE_ps2/docs/ch434_current_frame_lightbuffer_closeout.md
thejayman77 ba74bbd5aa Snapshot: fog implementation + fidelity tooling baseline (pre bilinear-clamp fix)
Per-vertex GS fog end-to-end (gs_stub emit incl. persp_emit5, gs_prim_list_feeder
XYZ2->XYZF2 on PRIM.FGE, gs_make_sh3_scheduler_fixture.py F/FGE packing), new fog
TBs, fidelity attribution tooling. Functional baseline before removing the dead
bilinear lerp8 clamps (Codex: 161-node comb loop -> -0.042ns setup fail).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 19:56:46 -04:00

81 lines
3.8 KiB
Markdown

# Ch434 — current-frame light-buffer reconstruction
## Fidelity gap
Ch433's accepted `zsrt139f44` frame used the captured contents of TBP 11264
for the two late full-screen darkening sprites. That texture was stale GS
local memory rather than the intermediate produced by the current frame.
The result retained recognizable scene structure, but its lighting was not
chronologically connected to the scene being rendered.
The omitted current-frame chain is:
1. a PSMCT16S light target at FBP 256/TBP 8192, built by a clear, 2,053
untextured Z-tested additive/subtractive volume draws, and a final bias
sprite;
2. conversion to the CT32 target at FBP 320/TBP 10240;
3. three CT32 ping-pong sprites through FBP 352/TBP 11264 and FBP 320;
4. the authentic draws 196167 and 196177, which sample the final TBP 11264
image and blend it across the display.
Ch434 reconstructs this chain as ordered static fixtures. The PSMCT16S
target is rendered with the accepted scene Z, decoded to linear CT32, and
then passed through the captured CT32 sprite states before the two display
composites. This is a static fidelity bridge; animated render-to-texture
still requires native target residency and ping-pong ownership in RTL.
## Triangle-record topology repair
The first integrated attempt exposed a fixture-contract bug. The scheduler
generator expanded captured TRI_STRIP, TRI_FAN, and SPRITE topology into
independent three-vertex records, while preserving the captured PRIM type in
the feeder header. Because the feeder reissues PRIM for every record, a
SPRITE record was assembled as a two-vertex sprite plus a dangling vertex,
and strip/fan records restarted with the wrong topology.
`tools/gs_make_sh3_scheduler_fixture.py` now advertises TRIANGLE for every
expanded three-vertex record while preserving authentic TME, ABE, FST, and
CTXT state. This changed the broken all-white ping-pong result into a stable
binary light mask that retains the booth and character geometry through all
three copies.
## Rejected diagnostics
- `zsrt139f46` painted the untextured volume family directly into the display.
It was useful for isolation but architecturally wrong because the family
targets PSMCT16S off-screen storage. It was never deployed.
- `zsrt139f48` used the reconstructed chain before the triangle-record repair.
It passed the internal RTL scoreboard but collapsed the intermediate to
white and over-darkened the display. Its mapped PCSX2 score was
MAE/RMSE 19.4763/29.3660, so it was rejected and never deployed.
## Accepted result
`zsrt139f49` combines the accepted Ch433 scene, the topology-correct
current-frame light composite, and the existing textured-alpha tail. The
production registered-gradient simulation passed all 311 epochs:
- 2,339,914 fragments fed and 2,286,292 passed;
- zero fragment drops, color overflows, and AXI errors;
- 311 complete markers and drains;
- zero final Z and color scoreboard mismatches.
Against the PCSX2 frame through the accepted display map, f49 scores
MAE/RMSE 14.1067/21.3468. This improves both metrics from f44's
14.8127/21.5567, with a 0.7060 MAE reduction.
No compile was required. The timing-clean Ch432 RBF ran the new assets on
the Terasic board. All 311 runtime texture, palette, staging, drain, and
zero-drop gates passed. The host reported 244,981 nonzero words, bounds
`(0,0)..(511,479)`, sum32 `0x385dc4f6`, xor32 `0x6330653c`, and selected HDMI
line-buffer source 1.
The 307,200-word board framebuffer is byte-identical to production
simulation at SHA-256
`adb21828465758b0601956abef39b649f1f441a0a51831f90826ae76936f6606`.
The accepted board image is
`captures/gs/silenthill3/extracted/sh3_zsrt139f49_ch434_board.png`; its mapped
comparison is
`captures/gs/silenthill3/extracted/recon/sh3_zsrt139f49_ch434_board_mapped.png`.
Ch434 is accepted, and f49 is the current live HDMI baseline.