mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
6e2eadacd9
Found in the R4 integration round: with the widescreen package at 21:9 a Grand Prix race ran at ~55 guest frames/s at 1x (debug build, GL timer queries off) instead of 60. A CPU sample put ~57% of the emulation thread in glb_draw_line -> gpu_geometry: every line was drawn on its own, flushing the textured batch, then rebinding the wide surface and the hr surface for its native-wide mirror. R4 draws hundreds of lines per race frame. With native-wide on, a line now joins the flat batch as a GL_LINES batch: same vertices, program, line width, painter order and batch keys (semi, mask-set), and one draw plus one mirror per batch. The batch holds one primitive mode; a line after triangles (or the other way round) flushes it first. A line the backdrop-stretch gate would widen keeps the immediate path, since the flat batch mirrors unstretched. Until native-wide first configures a wide surface nothing changes. glb_wide_set_target() and glb_wide_disable_target() now drain the flat batch into the old target first, as they already did the textured batch (the draw-area change that precedes a switch flushed it anyway; this makes it hold for any caller). - R4 21:9 at 1x from one race savestate (widescreen-only build, timer queries off): 54.8 -> 59.9 guest frames/s over 10 s. - New ctest native_wide_line_batching (source guard): the gate, one mode per batch, the batch and its mirror drawn with the batch's mode and line width, the target switches draining first. It fails on the old code. - Pixels: the 1x native-wide case of the GL scale fixture (a line across both margins) is checked on the integration branch, which carries that fixture; see the PR description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>