mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
2641f7c59b
Framework fixes surfaced while bringing up a title that stresses overlays, HD texture replacement and PGXP at a doubled CRTC rate. All are general; the title's own configuration stays in its game repository. CORRECTNESS * Overlay DLL shim was deleted by the preprocessor. compile_overlays.py injected overlay_dispatch_preamble.c.inc after the syntactically LAST #include. A conditional i-cache include moved that anchor inside an #else, and DLL builds define PSX_OVERLAY_DLL_BUILD, so the callback definitions preprocessed away and every overlay DLL failed to link. Any title using overlays would silently fall back to per-instruction interpretation. The shim is now anchored to the unconditional #include "psx_runtime.h" and raises if that anchor is absent. * Overlay capture kept stale PC bitmaps when executed code later became data, so one variant's PC set could be compiled against another variant's bytes. overlay_watch_note_write now retires the whole page's execution/dispatch epoch when any executed word is overwritten; static demand is keyed by (load_addr, size, bytes) and resolved only against matching range identities. * VRAM-to-VRAM copies only invalidated the destination and never registered it as a replacement candidate, so textures arriving by copy could not be dumped or replaced at all. gr_copy_rect now calls tex_pack_on_copy with the same (texture,palette) key semantics as CPU uploads. * PGXP shared-edge seams: a per-primitive all-or-nothing gate cannot stop two adjacent primitives disagreeing about a shared endpoint, so the edge is submitted at two sub-pixel positions. Adds a frame-stamped canonical endpoint cache keyed by final integer screen position: the first use fixes the coordinates and every later occurrence reuses them. * PGXP provenance: PGXPValue carries per-component X/Y/Z projection ids, so a value assembled from different projections can no longer arm correction. Destructive AND/XOR/NOR/SLT, link and COP0 writes now invalidate shadows, and the SXYP shadow FIFO shifts with guest SXY. * Precise NCLIP no longer replaces guest MAC0. It is telemetry only, so face visibility stays bit-exact with the integer GTE. * Removed two counters that were reported as correctness evidence but were never incremented anywhere. PERFORMANCE * PSX_ENABLE_LTO plus a noinline guard on the shared cycle wrappers. Unguarded ThinLTO clones hot interlock bodies and REGRESSES the hot path; guarded, it becomes a win. Adds runtime/tests/bench_psx_runtime_hotpath.c, which verifies variant equivalence by digest so codegen changes are measurable. * Cycle accounting: emitters select specialized arity-0/1/2/3 helpers at generation time instead of a generic dependency-mask loop; main-RAM loads combine base/wait/completion into one exact charge. Exactness is covered by pipeline-state, load-state, deadline-crossing and cross-device causality tests. * HD texture invalidation replaced a linear scan of up to 8192 upload records per VRAM write with a tile-refcount index; out-of-domain writes early-out. * Translation/text-substitution dispatch is gated behind a monotonic mutation epoch instead of running a callback on every dispatch. * card_data_writes_check no longer runs on every RAM write. CAPABILITY * fixed_outer_aspect: the outer presentation aspect becomes a function of user configuration only. Scene classification selects content transforms, never the outer viewport, so menus/FMV stay centred undistorted inside a wide canvas. VERIFICATION AND LIMITS docs/UPSTREAM_2026-08-20.md audits each change against the diff, marks unsupported claims UNKNOWN, and lists a suggested PR split and review focus. Unit and structural tests accompany each item, but this body of work has NOT been validated end-to-end against a fixed reproducible workload -- reviewers should treat the timing-exactness and PGXP changes as the highest-risk areas. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
49 lines
2.0 KiB
C
49 lines
2.0 KiB
C
#ifndef PSXRECOMP_PRESENT_RING_H
|
|
#define PSXRECOMP_PRESENT_RING_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Present-classification ring: one entry per present decision in
|
|
* sdl_vblank_present, for EVERY backend (software, GL, Vulkan). Records how
|
|
* the content was classified (FMV/full-2D 4:3-safe, native-wide, or the
|
|
* canonical read) and whether a native-wide present fell back to the
|
|
* canonical width — the fallback is invisible on screen except as a
|
|
* horizontal stretch, so it must be observable in data. Always-on; queried
|
|
* via the TCP debug server "present_ring" command. */
|
|
|
|
typedef enum {
|
|
PRES_PATH_BLANK = 0, /* display disabled — blank frame */
|
|
PRES_PATH_CONTENT_43 = 1, /* FMV / full-2D frame, 4:3-safe content */
|
|
PRES_PATH_WIDE = 2, /* native-wide surface (canonical + EXTRA) */
|
|
PRES_PATH_CANONICAL = 3, /* canonical read; stretches when the window
|
|
is wider than the display aspect */
|
|
} PresPath;
|
|
|
|
typedef struct {
|
|
uint32_t frame; /* s_frame_count at present time */
|
|
uint16_t disp_w, disp_h;/* GPU display size */
|
|
uint16_t present_w; /* width actually presented */
|
|
uint16_t nw_extra; /* native-wide growth configured this frame */
|
|
uint8_t path; /* PresPath */
|
|
uint8_t wide_fellback; /* wide present attempted but surface missing */
|
|
uint8_t game_mode; /* ws gameplay-vs-2D classification */
|
|
uint8_t native_43; /* native-4:3 content policy at present time */
|
|
int32_t tag_delta; /* frames since newest sprite tag (clamped) */
|
|
uint16_t gte_verts; /* RTPS/RTPT verts, last completed frame */
|
|
uint16_t ovh_prims; /* overhanging polys, last completed frame (the
|
|
2D-only-scene classifier's world signal) */
|
|
} PresRingEntry;
|
|
|
|
uint64_t present_ring_total(void);
|
|
int present_ring_get(uint64_t seq, PresRingEntry* out);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PSXRECOMP_PRESENT_RING_H */
|