mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-11 11:21:38 -10:00
The shader backends read gyro, accelerometer and rest each frame from the video thread. They were published under a seqlock, whose reader started over - spinning - while the poll was mid-publication, and whose nine floats went through nine atomic stores and loads. They are now three slots of nine floats: the poll writes its own and hands it over with one exchange for the middle slot; the reader, when the middle is new, exchanges its slot for it and reads the floats where they lie. Neither side ever waits or retries, and a read never mixes two polls. The exchange lives in input_sensor_snap.h so a test can drive the same code. sensor_snap_test publishes as fast as it can from one thread while another reads, and checks no read is mixed or goes backwards and the newest is read once the writer stops; CI runs it under ASan, TSan and Wine. The frontend harness's idle lane counts publications instead of the sequence.