mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
eb301961f6
Backend-neutral core for the opt-in [video] render_thread: the emulation thread appends records to a single-producer/single-consumer ring and the render thread replays them in order with the graphics context current. rt_frame_end bounds closed frames in flight (backpressure), the render thread can tell a frame is stale, and rt_acquire is the sync point: drain, then move the context to the emulation thread until rt_release. No lock is held while a record executes. render_thread_test drives it with a fake executor and context token: ordering and payload integrity across ring wraps, oversize refusal, the in-flight bound under a slow consumer, stale detection, randomized acquire/release interleaving and stop while held (TSan clean). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>