Skip to content

victory-gpu: [display] fps_limit and F11/Alt+Enter borderless toggle - #773

Open
Revens2 wants to merge 1 commit into
fxceless:mainfrom
Revens2:fix/issue-727
Open

Revens2 wants to merge 1 commit into
fxceless:mainfrom
Revens2:fix/issue-727

Conversation

@Revens2

@Revens2 Revens2 commented Nov 25, 2026

Copy link
Copy Markdown

Refs #727 (window mode, fps limit) and #728 (phase 0, measurement). Does not close either.

What is in it

  • [display] fps_limit in victory.toml (env VICTORY_FPS_LIMIT, 0 = off, at most 1000). Applied just before Present: sleep until 1.5 ms before the deadline, then spin. A late frame is not made up for (no burst after a slow frame). The title's own frame clock (frame.rs) is untouched.
  • [display] window_mode = "windowed" | "borderless" (env VICTORY_WINDOW_MODE) and F11 / Alt+Enter at run time, on the window victory-gpu creates. Borderless is a popup over the monitor the window is on (flip model, no exclusive fullscreen); the swap chain keeps the title's size and is stretched, so another aspect ratio is stretched too. The windowed rectangle and style are restored on the way back. The toggle runs on the window's own thread. A window made by the title is not touched.
  • One log line with the frame rate: mean and longest gap between presents, and how long the limit held a present back (first piece of Frame pacing and present latency: measure first, then waitable swap chain, tearing and an interval override #728 phase 0; no behaviour change when the limit is off).
  • Config errors name their source (VICTORY_FPS_LIMIT, [display] fps_limit, window_mode). README and victory.example.toml document the keys.

Overlap: #433 ([window] size, start-up size) and #131 (borderless by default) touch the same window code. This adds no size setting and keeps the default windowed, so it should rebase on either; config.rs and host.rs will need a manual merge with #433. Not duplicated: no [window] table here.

Tested

  • cargo test --workspace --locked --no-fail-fast: 540 passed, 0 failed, 10 ignored (WARP, Windows 11). One earlier run failed inplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset once and passed on the next two runs; this change does not touch inplace.rs; cause not investigated.
  • Unit tests: the pacer (no limit, spacing, late frame, a real 50 fps wait of at least 19 ms) and the config parsing (defaults, env over file, error sources).

Not tested

AI use
Written with Claude Sonnet 5.5 (Claude Code).

Adds an optional frame-rate limit applied before Present (sleep, then spin; a late frame is not made up for), a window mode switch on the presenting window (F11 or Alt+Enter, or window_mode = borderless at start), and a log line with the gaps between presents. Refs fxceless#727 and fxceless#728 (phase 0).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:17:05.933326Z 0ad4aeb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

clquwu added a commit to clquwu/leonida-ultimate that referenced this pull request Nov 25, 2026
…A_FPS_LIMIT pacing

Implements Wave 11A Ranks #1, #2, and #3 (GPL-3.0 attributed, zero RVAs, zero non-trivial thread_local):

1. Buffered overlapped DirectStorage + page-cached read-only pack opens (adapted from Marvisak/VIctory#2427, GPL-3.0):
   - runtime/shims/file_system.cpp: strip FILE_FLAG_NO_BUFFERING on read-only non-overlapped CreateFileW opens so Windows page cache and sequential read-ahead accelerate RPF pack reads while preserving the flag for CreateFileA, write opens, and overlapped opens.
   - runtime/shims/dstorage.cpp: open primary DirectStorage file handles with FILE_FLAG_OVERLAPPED using per-worker OVERLAPPED + event handles (with CancelIoEx safety on failed waits) so all worker threads issue true parallel cached I/O on the same pack file; flip LEONIDA_DSTORAGE_NO_BUFFERING default to 0 (opt-in =1 for low-RAM hosts).

2. Fast C++20/SSE2 zlib_inflate + lock-free DirectStorage stats & Status batching (inspired by Marvisak/VIctory#1355, GPL-3.0):
   - runtime/src/zlib_fast.h & runtime/src/shader_library.h: 11-bit canonical Huffman primary LUT, register-resident 64-bit bit buffer with single-refill fast inner loop, bulk memcpy/memset/doubling LZ77 copies, single-memcpy stored blocks, and chunked SSE2 Adler-32 (5.6x-6.5x speedup on 4 MiB dynamic+LZ77 benchmark: 230.9 MiB/s -> 1,302-1,501 MiB/s).
   - runtime/shims/dstorage.cpp: replace global stats().mutex locks on hot counters with lock-free relaxed std::atomic counters; batch independent file requests across non-fence Status entries while preserving exact queue-order Status completion, FirstFailure attribution, alias checks, and hard Signal/Event barriers.

3. Configurable uncapped / target frame pacing via LEONIDA_FPS_LIMIT (adapted from fxceless/victory-fork#773 & ubiquitarianism/leonida@77ded8a050, GPL-3.0):
   - runtime/src/frame_pacer.h & runtime/shims/xbox_present.cpp: support LEONIDA_FPS_LIMIT=0 (uncapped, even with LEONIDA_FRAME_PACING=1) and LEONIDA_FPS_LIMIT=1..1000 (overrides 30 Hz title interval and paces PresentX via sleep+1.5ms spin without catch-up bursts, using sync_interval=0).
   - runtime/src/main.cpp: skip forcing LEONIDA_FRAME_PACING=1 in --first-run-ui when LEONIDA_FPS_LIMIT is set.

Verification: 7/7 CTests pass with Vulkan validation on RTX 3080 (0 validation errors), check_no_game_data.py 0 violations.
CernyMuzCZ pushed a commit to CernyMuzCZ/vitezstvi-fork that referenced this pull request Nov 25, 2026
CernyMuzCZ pushed a commit to CernyMuzCZ/vitezstvi-fork that referenced this pull request Nov 25, 2026
…; VICTORY_KBM=0: the old stand-in keys)

Ported from the ScarlettPort runtime's fx-kbm work (victory-core kbm, pace and
fastboot; gameinput feeding them; the window procedure capturing the cursor on
a click and freeing it on focus loss). A WM_CLOSE without the menu command also
ends the title now. GameInput's reading history stays at 256 (fxceless#23); F11 and
Alt+Enter borderless (fxceless#773) are unchanged. See docs/input.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant