mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
769839bb5f
Three fixes to the HD texture replacement path, all found by looking at the same artifact: faint vertical hairlines along every glyph boundary in the replaced font, plus a stray fragment floating above the loading screen's cursor glyph. REPL_FS mapped a PS1 texel index straight to a normalised coordinate: (uv - origin) / src. An integer u addresses texel u, whose span in the replacement is [u, u+1), so that lands on the texel's left EDGE, half a texel short of its centre. On the PS1 path NEAREST still resolves to the right texel and the omission is invisible; this path is LINEAR (the whole point is detail the texel grid does not carry), and there the shift blends in whatever sits one texel over. On a font atlas the neighbour is the adjacent glyph's cell, so every glyph quad drew a hairline of its neighbour along its own edge -- background-coloured slivers through letters, ink-coloured ones in the gaps, and at the cursor cell a whole fragment of the glyph above it. Sample at +0.5 and clamp to v_limits.zw rather than +0.999, so the far edge lands on the last texel's centre instead of past it. Replacement uploads are also mipmapped now. A pack image is an integer upscale of a source the game draws at or near native texel size, so on screen it is minified; unmipmapped LINEAR samples roughly one texel in N and drops the rest, which shreds thin hard-edged strokes. The deepest mip a draw can select sits around the original texel grid, where a level is the box-average of one source pixel -- so this is never worse than vanilla and sharpens as internal resolution rises. Both of those were diagnosed at 508x256, because screenshot_hires on the GL backend was ensure_cpu() + sw_render_display_hires(): ensure_cpu() packs the FBO down to the 1x 15-bit CPU mirror, so every supersampled pixel was averaged away BEFORE the "hires" resolve ran. It then filled dw*dh of a (dw*S)*(dh*S) buffer and the caller honestly downgraded to "scale 1". The command silently could not see anything that exists only at high internal resolution -- exactly the class of work it was written to verify. Read the display rect out of the hr FBO directly instead. Verified: 3048x1536 at scale 6, correct colours and orientation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>