d3d12_xs: LEONIDA_TITLE_HUD shows frame rate, memory and pipeline compiles in the window's title bar (RT-TITLE-HUD) #1922

Manually merged
github merged 2 commits from gh-pr/1922/head into gh-pr/1922/base 2026-11-26 10:11:19 +00:00
Owner

@⁠kawaii-shakal on GitHub · 2026-11-25 15:52 UTC · original
kawaii-shakal:title-bar-hud → main · +280 −4 · 5 files · 2 commits · merged 2026-11-25 19:39 UTC

Claimed in the coordination issue as RT-TITLE-HUD: #1608

Problem

During a boot, a tester can't tell whether the game is slow because of frame time, because of memory pressure, or because pipelines are being compiled in the frame. The log has the numbers, but only every LEONIDA_MEM_PROBE seconds and scattered over hundreds of thousands of lines.

Change

With LEONIDA_TITLE_HUD=1, the title bar of the window the title presents in shows, updated twice a second:

Leonida | 2 fps 500.0 ms (worst 10532) | RAM 28.1 GB (ws 6.5) | VRAM 9.2/14.9 GB +0.9 shared | PSO 20g 926c, compiling 2.4 s | 4:39
  • Frames: fps and the average and worst frame time, counted from successful PresentX calls.
  • Memory: the process's private bytes and working set (GetProcessMemoryInfo).
  • GPU memory: local usage against its budget, plus non-local usage (IDXGIAdapter3::QueryVideoMemoryInfo). The adapter is the hardware one with the most dedicated memory, taken from the host's own dxgi.dll.
  • Pipelines: graphics and compute pipelines created, and the seconds spent in vkCreate*Pipelines in the last interval. Several compiler threads can push this above the interval. It needs LEONIDA_MEM_PROBE, which counts them; without it the field reads PSO -.
  • Uptime: the time since the first present.

The text is set from a thread of its own with SendMessageTimeout(SMTO_ABORTIFHUNG), so a busy or hung window thread never holds a present. runtime/shims/title_hud.h implements it, and it is wired into d3d12_xs_device.cpp's PresentX state. docs/boot.md documents the variable. It is off by default.

Tested (Windows 11 Pro 26300, RTX 5070 Ti, VS 2026 RelWithDebInfo)

  • CTest title_hud: a real window owned by the test's main thread gets the HUD text from the HUD thread. ~60 Hz presents give a plausible frame rate (35 fps under Sleep(16) here). A window that stops pumping does not hang the HUD's shutdown, and a HUD destroyed at once returns at once.
  • Real boot: the line above is from a 1.0.2.1 retail boot during the story load with LEONIDA_MEM_PROBE=10, while library compute pipelines were being compiled in the frame.

🤖 Generated with Claude Code

**@⁠kawaii-shakal** on GitHub · 2026-11-25 15:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1922) `kawaii-shakal:title-bar-hud` → `main` · +280 −4 · 5 files · 2 commits · merged 2026-11-25 19:39 UTC Claimed in the coordination issue as RT-TITLE-HUD: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 ### Problem During a boot, a tester can't tell whether the game is slow because of frame time, because of memory pressure, or because pipelines are being compiled in the frame. The log has the numbers, but only every `LEONIDA_MEM_PROBE` seconds and scattered over hundreds of thousands of lines. ### Change With `LEONIDA_TITLE_HUD=1`, the title bar of the window the title presents in shows, updated twice a second: ``` Leonida | 2 fps 500.0 ms (worst 10532) | RAM 28.1 GB (ws 6.5) | VRAM 9.2/14.9 GB +0.9 shared | PSO 20g 926c, compiling 2.4 s | 4:39 ``` - **Frames:** fps and the average and worst frame time, counted from successful PresentX calls. - **Memory:** the process's private bytes and working set (`GetProcessMemoryInfo`). - **GPU memory:** local usage against its budget, plus non-local usage (`IDXGIAdapter3::QueryVideoMemoryInfo`). The adapter is the hardware one with the most dedicated memory, taken from the host's own `dxgi.dll`. - **Pipelines:** graphics and compute pipelines created, and the seconds spent in `vkCreate*Pipelines` in the last interval. Several compiler threads can push this above the interval. It needs `LEONIDA_MEM_PROBE`, which counts them; without it the field reads `PSO -`. - **Uptime:** the time since the first present. The text is set from a thread of its own with `SendMessageTimeout(SMTO_ABORTIFHUNG)`, so a busy or hung window thread never holds a present. `runtime/shims/title_hud.h` implements it, and it is wired into `d3d12_xs_device.cpp`'s PresentX state. `docs/boot.md` documents the variable. It is off by default. ### Tested (Windows 11 Pro 26300, RTX 5070 Ti, VS 2026 RelWithDebInfo) - **CTest `title_hud`:** a real window owned by the test's main thread gets the HUD text from the HUD thread. ~60 Hz presents give a plausible frame rate (35 fps under `Sleep(16)` here). A window that stops pumping does not hang the HUD's shutdown, and a HUD destroyed at once returns at once. - **Real boot:** the line above is from a 1.0.2.1 retail boot during the story load with `LEONIDA_MEM_PROBE=10`, while library compute pipelines were being compiled in the frame. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A tester has no way to see, during a boot, whether the game is slow because of frame time, memory pressure or
pipelines compiled in the frame. With LEONIDA_TITLE_HUD=1 the window the title presents in gets, twice a
second:
- fps and the average and worst frame time from PresentX;
- private memory and working set;
- local GPU memory against the DXGI budget, and shared GPU memory;
- pipelines created and the seconds spent in vkCreate*Pipelines in the last interval (with
  LEONIDA_MEM_PROBE);
- time since the first present.

A thread of its own sets the text with SendMessageTimeout, so a busy or hung window thread never holds a
present. title_hud_test drives a real window from another thread and checks the text and the shutdown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A hang read as "0 fps 0.0 ms (worst 0)", which looks like a slow frame. Now it reads
"0 fps, no frame for 12.5 s". title_hud_test checks it after presents stop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:11:18 +00:00
github manually merged commit 1c5e2dcab1 into gh-pr/1922/base 2026-11-26 10:11:19 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 19:39 UTC · original

Merged, thanks! Tested 1c5e2dcab merged onto main with the full Windows suite under Wine (llvmpipe and a RADV iGPU): title_hud is new and passes on both devices, and no other test changed. The one difference, xmem_no_write_watch on lavapipe, is the known first-run flake: re-run alone it passed every time, and main fails it the same way in a fresh prefix.

It also works in a retail run under Wine on an RX 7900 XTX with LEONIDA_TITLE_HUD=1.

  • Checked on main e18b59a5b + 1c5e2dcab: it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 5 changed files.
  • Follow-up idea: under Wine the private-memory and VRAM figures read 0. VK_EXT_memory_budget would give the VRAM side from the Vulkan device itself.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 19:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1922#issuecomment-7172598702) Merged, thanks! Tested `1c5e2dcab` merged onto `main` with the full Windows suite under Wine (llvmpipe and a RADV iGPU): `title_hud` is new and passes on both devices, and no other test changed. The one difference, `xmem_no_write_watch` on lavapipe, is the known first-run flake: re-run alone it passed every time, and `main` fails it the same way in a fresh prefix. It also works in a retail run under Wine on an RX 7900 XTX with `LEONIDA_TITLE_HUD=1`. - **Checked on `main` `e18b59a5b` + `1c5e2dcab`:** it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 5 changed files. - **Follow-up idea:** under Wine the private-memory and VRAM figures read 0. `VK_EXT_memory_budget` would give the VRAM side from the Vulkan device itself. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.