mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
2211ecabf3
8K is 18x at a 240-line reference, and a full-VRAM surface at 18x is 18432 px wide: over the 16384 limit of Apple's GL, Intel and MoltenVK. A title only needs its displayed frame at 18x, so past the full-VRAM limit the GL backend now splits the work: - The authoritative VRAM stays the ordinary hr surface at 1x, i.e. the native renderer unchanged: pack, CPU readback, render-to-texture and VRAM copies are exactly the native results (s_hr_scale; s_scale stays the presented scale gr_scale reports). - A presentation-only surface at S covers the displayed columns W = [x0, x1) x all 512 rows (R4: 0..319, 5760x9216 at 18x, 405 MiB). Every GPU write touching W is mirrored into it: textured and flat batches, lines (quads), fills, uploads, the depth24 clear, and VRAM copies (hi to hi when the source is in W, otherwise the 1x source upscaled; both staged before drawing so overlapping copies read pre-copy pixels). It keeps its own stencil. A separate blit program carries the window projection, so the canonical shaders are untouched. - W grows (64-column aligned) the first time a display rectangle outside it is presented, seeded by upscaling the 1x content. Present, hold-last, interpolation capture, screenshot_hires and the native-wide centre read it; a display it cannot hold presents at 1x. It engages only when the full-VRAM surface cannot hold the request (driver limit or budget), sized so a 320-wide window fits both; up to 16x on the M4 nothing changes. PSX_GL_HIRES_WINDOW=0/1 disables or forces it. The launcher note and video_info (hr_scale, windowed, hires_window_*, hires_fbo) report it. Default-off: at 1x and whenever the full-VRAM surface fits, the paths are the previous ones (same native-VRAM and present digests on a fixed scene at 1x and 2x). Tests: gl_scale_invariance_test now also forces the window at 2/3/5/9x and requires its frame at internal resolution to be byte-identical to the full-VRAM surface at the same scale (copies inside, into and across the window edge, fills/uploads across it, mask, all blend modes) with native VRAM identical to 1x, and runs it at 18x; gl_scale_limits_test covers the window clamp; guards pin that it only engages past the full-VRAM limit. Verified in R4 on an M4: the 8K preset renders 5760x4320 in a race (rear- view mirror present) and 5760x8640 on a 480i menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>