Expose independent frame presentation and emulated VBlank advancement
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start with the referenced VSync implementation in psyz/src/psyz/libapi.c and Psyz_VideoVSync plus browser waiting in psyz/src/platform/sdl3_common.h; compare their responsibilities with related issue #232. Define an API contract that separates presentation, elapsed-time VBlank processing, and optional display waiting while specifying controller sampling, callbacks, suspension/resumption, and statistics. Done when the new opt-in path covers those behaviors and the existing PsyQ-compatible VSync behavior is preserved.
Written by the indexing model from the issue text.
Description
An application with a fixed simulation rate and interpolated rendering needs to present frames without waiting for, or generating, another emulated VBlank. We encountered this while adapting a game to run its simulation at 30 Hz and render at up to 120 Hz in the browser.
Currently VSync(0) combines presentation, waiting, controller sampling and kernel/VBlank callbacks. VSync(-1) reads the emulated clock, but does not perform the corresponding VBlank processing. There is no public presentation-only path in the tested revision.
Example workload
- Run an Emscripten application from
requestAnimationFrameon a 120 Hz display. - Advance game simulation in fixed 1/30-second steps and interpolate between snapshots.
- Present one frame per browser callback, while preserving the NTSC or PAL VBlank rate.
Calling VSync(0) for every rendered frame also invokes its waiting and VBlank processing. Reading VSync(-1) alone does not provide the missing presentation and interrupt-processing operations. The application needs these responsibilities to be independently accessible.
Requested capability
Provide an opt-in API to:
- Present the current GPU output without waiting for another browser callback.
- Advance emulated VBlank processing from elapsed emulated time, independently of rendered-frame count.
- Wait for a display opportunity when the application does not already own the host frame loop.
Keep the existing PsyQ-compatible VSync behavior. Controller sampling, callbacks, suspension/resumption and presentation statistics need an explicit contract for the new path. Game simulation and object interpolation remain application responsibilities.
Local experiment
A local prototype separates non-waiting presentation from a VBlank pump. In the same Rewired browser test, over eight-second windows:
| Path | Simulation steps/s | Render submissions/s | Browser RAF callbacks/s | Emulated VBlanks/s |
|---|---|---|---|---|
Previous Rewired VSync loop |
29.98 | 59.96 | 119.92 | Not recorded |
| Separate presentation / clock | 29.99 | 119.72 | 119.97 | 59.98 |
These are measurements of our port, which already has local PsyZ patches, not an unmodified-Psyz benchmark. Render submissions and RAF callbacks are not proof of physical screen presentation. This is an API request, not a claim that legacy VSync cannot support any high-refresh application.
Reference
Tested dependency: PsyZ 35c673ecf1c4ba799a812d701918c2c52935475b.
Related: #232. This issue focuses on API separation; changing browser main-loop ownership is a separate concern.
- Dominant language
- C
- Stars
- 107
- Forks
- 26
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Xeeynamo/psyz
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Similar issues
-
GXF: heap buffer overflow in parse_ad_cdp() — unbounded cc_count in CDP cc data sectionPossibly taken @pranayr710 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
CCExtractor/ccextractor#2498 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: services kind: bug preview-effort: small priority: low
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Static Analysis failurePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100