Skip to content

present: fix short-band letterbox for native display modes + UV edge bleed - #74

Merged
mstan merged 3 commits into
mstan:masterfrom
OpokXeno:fix/present-letterbox-uv-inset
Jul 23, 2026
Merged

present: fix short-band letterbox for native display modes + UV edge bleed#74
mstan merged 3 commits into
mstan:masterfrom
OpokXeno:fix/present-letterbox-uv-inset

Conversation

@OpokXeno

Copy link
Copy Markdown
Contributor

Two independent present-path fixes, one commit each logical change.

1. Short-band letterbox squashes native short display modes

The short GP1(07h)-band letterbox (for MotK's 128-line FMV) fired for
any frame shorter than 240 lines. That also matches games whose native
display mode is short full-time — Xenogears runs 320×216 — so every 4:3
menu/load screen and every FMV got a ~10% vertical squash.

Fix, split by purpose:

  • 15-bit game frames never shrink: the adjustment is removed from
    gl_renderer_present_vram
  • FMV paths keep the correction, only where it belongs:
    gl_renderer_present (depth24 CPU path) and the SDL present
    (pin_43 && depth24_frame), and only for genuinely windowed video bands
    — under 80% of the 240-line field (< 192). MotK's 128-line FMV keeps
    its aspect fix; native 216/224-line modes fill the rect as on hardware.

2. Present UV rect bleeds edge pixels with GL_LINEAR

present_target_quad mapped quad corners to texel edges. With GL_LINEAR
and a scaled present, the outermost dest pixels blend the border texel with
whatever VRAM neighbors the content rect — visible 1–2 px stripes at image
edges with linear present filtering (e.g. menu frames showing columns of
the adjacent framebuffer at the right edge).

Fix: center-map the UVs with a half-texel inset
((x + 0.5) / tex_w(x + w - 0.5) / tex_w). Edge samples stay inside
the content rect; interior sampling is unchanged. Covers both callers
(canonical VRAM present and wide-FBO present).

Verification

  • Xenogears (320×216 native): menus, loads, and FMVs present at full
    height again; 16:9 gameplay unchanged; edge stripes gone with linear
    filtering on.
  • MotK FMV path untouched (gl_renderer_present keeps the band
    correction; only the band threshold moved to < 192).
  • Host: Linux, gcc, CMake; runtime + recompiler build clean.

OpokXeno added 3 commits July 22, 2026 19:32
Two present-path fixes:

1. The short GP1(07h)-band letterbox (MotK 128-line FMV) fired for any
   frame under 240 lines, which also catches games whose native display
   mode is short full-time (Xenogears runs 320x216): every 4:3
   menu/load and every FMV got a ~10% vertical squash. No numeric
   threshold separates the cases (216 < 224 too), so split by purpose:
   15-bit game frames never shrink (adjustment removed from
   gl_renderer_present_vram), and the FMV paths keep the correction
   only for genuinely windowed video bands (gl_renderer_present, and
   the SDL path gated on pin_43 && depth24_frame) with the band under
   80% of the 240-line field. MotK's 128-line FMV keeps its aspect fix;
   native 216/224-line display modes fill the rect as before.

2. present_target_quad mapped quad corners to texel edges, so with
   GL_LINEAR the outermost dest pixels blend the border texel with
   neighboring VRAM outside the content rect (visible 1-2px edge
   stripes with linear present filtering, e.g. menu frames showing the
   adjacent framebuffer). Center-map the UVs with a half-texel inset;
   interior sampling is unchanged. Covers both callers (canonical VRAM
   present and wide-FBO present).
@mstan
mstan merged commit 0920787 into mstan:master Jul 23, 2026
3 checks passed
@TechnicallyComputers TechnicallyComputers mentioned this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants