mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 02:56:36 -04:00
2a0536963c
Adds a software-renderer supersampling path so PSX games can render at a higher internal resolution with anti-aliased edges, configured per game via a new [video] block: [video] supersampling = 1..4 # internal-res SSAA factor (1 = native, default) antialiasing = true # linear present filtering How it works: when scale > 1, gpu_sw_renderer maintains g_hr, an S*-scaled mirror of VRAM. Every primitive is rasterized into native VRAM (byte- identical to the scale==1 path — VRAM stays authoritative for framebuffer readback, render-to-texture, transfers) AND into g_hr at S* resolution; textures are always sampled from native VRAM so texels keep native res while geometry/shading gain resolution. Block ops (fill/copy/CPU->VRAM/pixel write) replicate into the mirror. Display reads the mirror and the present path downsamples to the window (true ordered-grid supersampling). 24-bit (FMV) frames fall back to the native path. scale==1 allocates nothing and behaves exactly as before. To keep the mirror coherent, the two GP0 handlers that wrote vram[] directly (fill-rect 0x02 and the A0 CPU->VRAM image transfer) now funnel through sw_fill_rect / sw_vram_write — no VRAM write site bypasses the renderer. main.cpp sizes the SDL texture/logical-size/staging buffer to the internal resolution and selects linear vs nearest present filtering from the config. Verified on Tomba at supersampling=2: boots, renders a correct frame, holds 59.96 fps (pacing-limited, render headroom), dispatch_miss_total 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>