mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 02:56:36 -04:00
af49fb02d6
Move the remaining 2D primitives (flat/textured rects, fill, lines) onto the GPU, and present directly from the FBO color texture cropped to the display region instead of reading the whole 1 MB FBO back to CPU VRAM every frame. Why both at once: the native present read the `vram` array directly and relied on an incidental software op each frame (the HUD/sprites, drawn last) to trigger the FBO->CPU sync. Moving every primitive to the GPU removed that trigger, so a fully-GPU frame left `vram` stale -> black present (the earlier FMV->black regression). The fix is to present from the FBO when the GPU holds the freshest frame (gl_renderer_have_gpu_frame) and to sync explicitly (gl_renderer_sync_cpu) on the software/24-bit path. Result: the per-frame readback is gone for GPU scenes (the forest-lag source), software/FMV frames keep the CPU present path (verified: the MDEC intro renders correctly), and loads are faster. KNOWN-FOLLOWUP cosmetic artifacts to clean up: the GPU textured shader doesn't yet implement the texture window (wrap/mask), so tiled/wrapped sprites show seams; bilinear texture_filtering isn't honored on the GPU path; and the debug screenshot still reads CPU VRAM (stale under the FBO-present path) so captures can lag the on-screen image. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>