mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
37fdd3bd42
Root cause of every "enabling a pack erases the UI" failure, and it is not any
of the things that were blamed for it.
Uniforms are per-PROGRAM. s_repl_prog shares TEX_VS's source with s_tex_prog
but not its uniform state, and startup only initialises s_geo_prog and
s_tex_prog — with a comment saying exactly why that matters:
/* Default the new uniforms to the no-op (1.0 scale, 0 centre) -- GLSL
* would otherwise zero them, collapsing all x to 0. */
So every replaced primitive ran with u_xscale = 0, collapsing all x to
u_xcenter, and u_xhalf = 0, dividing by zero on top. Degenerate, off-screen,
rasterizing nothing. No replaced primitive had EVER drawn — including the 3D
ones that were previously reported as working; that sharpness was perspective
texturing, not the pack.
Initialise the replacement program's copies to the same no-op defaults, and
give the native-wide mirror inside draw_repl_prim this program's uniform
locations instead of s_tex_*'s, which would otherwise write the wide transform
into the other program while this one kept its defaults.
Rects are armed again. gpu_textured_rect decomposes into gpu_textured_triangle,
so the 2D layer was always routed correctly; withholding it was a mitigation
for this bug, not a fix for a missing path.
Measured in-race at 32:9 with princepeter64's Wip3out pack: 292 entries
indexed, 79 decoded, zero failures, 33215 replaced draws, and the complete HUD
present — lap counter, pickup indicators, timer, lap readout, speed and
acceleration bars.
The magenta probe (tex_pack repl_debug=1) is kept. Forcing replaced fragments
to a flat colour with no discard is what separated "the draw never lands" from
"it lands and samples nothing"; four hypotheses were tested and discarded
before that, each costing a rebuild.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>