Files
psxrecomp/overlay_toolchain/include/ws_scene_latch.h
Matthew Stanley fe42da2744 Merge release/native-rendering-20261003 into master
Keeps both lines: master's PGXP session, draw-distance clamps, masked rejects
and saturated-winding NCLIP; the release's render-pass kit additions, verified
media/disc extents, timeline/present rings, cull-scale sites. Overlay ABI v30.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 19:27:02 -07:00

29 lines
1.1 KiB
C

#ifndef PSX_WS_SCENE_LATCH_H
#define PSX_WS_SCENE_LATCH_H
#include <stdint.h>
/* Overhang proves there is revealable world content. Projection activity can
* maintain that proof, but MUST NOT establish it: 2D room jingles also use GTE.
* The CPU/GTE can build a frame across multiple vblanks before submitting any
* terrain packets, so gaps in GP0 overhang are not evidence of a scene change. */
typedef struct {
uint32_t last_frame, last_activity;
int initialized, confirmed;
} WsSceneLatch;
static inline int ws_scene_is_2d(WsSceneLatch* state, uint32_t frame,
int confirmed_overhang, int projecting_world,
uint32_t grace) {
if (state->initialized && (int32_t)(frame - state->last_frame) < 0)
state->confirmed = 0;
state->initialized = 1;
state->last_frame = frame;
if (confirmed_overhang) state->confirmed = 1;
if (confirmed_overhang || (state->confirmed && projecting_world))
state->last_activity = frame;
if (state->confirmed && frame - state->last_activity > grace)
state->confirmed = 0;
return !state->confirmed;
}
#endif