title HUD and dev overlay: VRAM from VK_EXT_memory_budget, private memory under Wine (RT-TITLE-HUD-VRAM-BUDGET) #2128

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

@⁠aslan2142 on GitHub · 2026-11-25 22:00 UTC · original
aslan2142:rt-title-hud-vram-budget → main · +577 −31 · 12 files · 3 commits · merged 2026-11-25 23:21 UTC

Claimed in the coordination issue as: RT-TITLE-HUD-VRAM-BUDGET (#1608)

What and why

The title HUD from #1922 (kawaii-shakal, thanks) reads 0 for VRAM and private memory under Wine. This PR makes both figures real. It also shows them in the dev overlay from #2137 (Snooozs), which had neither figure: it showed the working set and free RAM only.

  • VRAM:
    • Source: the HUD read VRAM from the host dxgi.dll's QueryVideoMemoryInfo, which Wine answers with 0. It now reads the runtime's own Vulkan device.
    • Device creation: create_vulkan_device_standalone enables VK_EXT_memory_budget when the GPU has it, like the other optional extensions, and records that as VulkanDeviceInfo::memory_budget.
    • Query: runtime/src/vulkan_memory_budget.h chains VkPhysicalDeviceMemoryBudgetPropertiesEXT into vkGetPhysicalDeviceMemoryProperties2. It sums heapUsage and heapBudget over the DEVICE_LOCAL heaps and reports the other heaps' usage as shared. rt::d3d12::vulkan_vram_budget(ID3D12Device*) reads one device.
    • Publishing: the dev overlay runs outside the device, so the device publishes its figure in runtime/src/memory_figures.h:
      • a device with the extension publishes a reader when it is created and withdraws it first thing in its destructor;
      • the lock is held during a read, so a reader never runs after its device is gone;
      • latest_vram() calls the reader at most once per 500 ms, for the HUD and the overlay together.
    • Fallback: without the extension, the HUD uses DXGI's figure when it has one, as on Windows. Otherwise both views show VRAM n/a instead of a false 0.0/0.0.
  • Private memory:
    • Cause: Wine's GetProcessMemoryInfo fills only the PROCESS_MEMORY_COUNTERS part and leaves PrivateUsage at 0. Measured in title_hud_test under Wine 11.22: PrivateUsage 0, PagefileUsage 6422528.
    • Fix: PagefileUsage is the same commit-charge figure on Windows 8 and later, so both views show the larger of the two. If both are 0, they show RAM n/a.
  • One helper for both views: memory_figures.h holds the private-bytes choice, the RAM ... and VRAM ... text and the publisher. title_hud.h and dev_overlay.h both call it. It needs no Vulkan headers, and Win32 only under _WIN32, so dev_overlay_test still builds on every host.
  • What each view shows:
    • HUD: ... | RAM 2.5 GB (ws 1.0) | VRAM 3.5/16.0 GB +0.5 shared | ...
    • Overlay: cores and free RAM keep their line, and a new last line reads RAM 2.5 GB (ws 1.0) VRAM 3.5/16.0 GB +0.5 shared.
    • Without the extension (and, in the HUD, without a DXGI figure), the VRAM part of both reads VRAM n/a.
  • Docs: docs/boot.md and the LEONIDA_DEV_OVERLAY row of runtime/README.md.

Related: #2083 gates title_hud_test on the Vulkan headers. It touches the same CMake target's registration, but not the lines this PR changes.

Tested

  • dev_overlay_test (extended; it also builds and passes natively on Linux with g++):
    • the overlay's text with no figures (RAM n/a VRAM n/a) and with both;
    • the private-bytes fallback (PagefileUsage only, both, neither);
    • the publisher: no figure before a device publishes, one read per 500 ms, another device's withdrawal leaves the figure in place, and the device's own withdrawal removes it.
  • title_hud_test:
    • the heap sums, including heaps past memoryHeapCount;
    • the DXGI fallback and Wine's all-zero answer;
    • this process's own private bytes;
    • a fake source in the window title, read at most once per refresh;
    • a HUD without its own source shows the figure a device published.
  • d3d12_vram_budget_test (new; registered with SKIP_RETURN_CODE 77):
    • the standalone device enables the extension exactly when the GPU lists it;
    • the device publishes its figure while it lives and withdraws it on release;
    • with a 64 MiB buffer alive, the budget is non-zero: on the iGPU, 271 MiB in use of 21 471 MiB device-local;
    • without the extension, it checks that the figure is n/a and skips.
  • Failing without the change: the new checks call memory_figures.h and read the overlay's seventh line, so they fail or do not build without it.
  • Full Windows suite under Wine (clang-cl + xwin build), compared with the main baseline:
    • lavapipe: 410 pass, 12 fail, 40 skip (baseline 393 pass, 12 fail);
    • RADV iGPU: 403 pass, 20 fail, 39 skip (baseline 386 pass, 20 fail);
    • verdict: no test went from pass to fail; 17 tests went absent -> pass on each device: d3d12_vram_budget, title_hud, dev_overlay and 14 from merges since the baseline.
    • The remaining failures fail the same way in the baseline. They are environment-only (bcrypt, file system, gameinput host, root signature, clears, present/swapchain, pipeline cache seed).
  • Other checks: tests/test_docs_*.py, test_text_write_line_endings.py, test_ci_registration.py, test_ctest_registration.py and scripts/check_no_game_data.py on the changed files all pass.
  • Not tested: Windows itself, and the game. The overlay window was not watched on screen; its text is the tested pure function.

GPUs tested: lavapipe (Mesa 26.3.1) and AMD Radeon iGPU gfx1036 (RADV, Mesa 26.3.1), Wine 11.22 (Staging) on Arch Linux. Both expose VK_EXT_memory_budget.

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
**@⁠aslan2142** on GitHub · 2026-11-25 22:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2128) `aslan2142:rt-title-hud-vram-budget` → `main` · +577 −31 · 12 files · 3 commits · merged 2026-11-25 23:21 UTC Claimed in the coordination issue as: RT-TITLE-HUD-VRAM-BUDGET (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why The title HUD from #1922 (kawaii-shakal, thanks) reads 0 for VRAM and private memory under Wine. This PR makes both figures real. It also shows them in the dev overlay from #2137 (Snooozs), which had neither figure: it showed the working set and free RAM only. - **VRAM**: - **Source:** the HUD read VRAM from the host `dxgi.dll`'s `QueryVideoMemoryInfo`, which Wine answers with 0. It now reads the runtime's own Vulkan device. - **Device creation:** `create_vulkan_device_standalone` enables `VK_EXT_memory_budget` when the GPU has it, like the other optional extensions, and records that as `VulkanDeviceInfo::memory_budget`. - **Query:** `runtime/src/vulkan_memory_budget.h` chains `VkPhysicalDeviceMemoryBudgetPropertiesEXT` into `vkGetPhysicalDeviceMemoryProperties2`. It sums `heapUsage` and `heapBudget` over the `DEVICE_LOCAL` heaps and reports the other heaps' usage as shared. `rt::d3d12::vulkan_vram_budget(ID3D12Device*)` reads one device. - **Publishing:** the dev overlay runs outside the device, so the device publishes its figure in `runtime/src/memory_figures.h`: - a device with the extension publishes a reader when it is created and withdraws it first thing in its destructor; - the lock is held during a read, so a reader never runs after its device is gone; - `latest_vram()` calls the reader at most once per 500 ms, for the HUD and the overlay together. - **Fallback:** without the extension, the HUD uses DXGI's figure when it has one, as on Windows. Otherwise both views show `VRAM n/a` instead of a false `0.0/0.0`. - **Private memory**: - **Cause:** Wine's `GetProcessMemoryInfo` fills only the `PROCESS_MEMORY_COUNTERS` part and leaves `PrivateUsage` at 0. Measured in `title_hud_test` under Wine 11.22: `PrivateUsage 0, PagefileUsage 6422528`. - **Fix:** `PagefileUsage` is the same commit-charge figure on Windows 8 and later, so both views show the larger of the two. If both are 0, they show `RAM n/a`. - **One helper for both views:** `memory_figures.h` holds the private-bytes choice, the `RAM ...` and `VRAM ...` text and the publisher. `title_hud.h` and `dev_overlay.h` both call it. It needs no Vulkan headers, and Win32 only under `_WIN32`, so `dev_overlay_test` still builds on every host. - **What each view shows:** - HUD: `... | RAM 2.5 GB (ws 1.0) | VRAM 3.5/16.0 GB +0.5 shared | ...` - Overlay: cores and free RAM keep their line, and a new last line reads `RAM 2.5 GB (ws 1.0) VRAM 3.5/16.0 GB +0.5 shared`. - Without the extension (and, in the HUD, without a DXGI figure), the VRAM part of both reads `VRAM n/a`. - **Docs:** `docs/boot.md` and the `LEONIDA_DEV_OVERLAY` row of `runtime/README.md`. Related: #2083 gates `title_hud_test` on the Vulkan headers. It touches the same CMake target's registration, but not the lines this PR changes. ### Tested - **`dev_overlay_test`** (extended; it also builds and passes natively on Linux with g++): - the overlay's text with no figures (`RAM n/a VRAM n/a`) and with both; - the private-bytes fallback (`PagefileUsage` only, both, neither); - the publisher: no figure before a device publishes, one read per 500 ms, another device's withdrawal leaves the figure in place, and the device's own withdrawal removes it. - **`title_hud_test`:** - the heap sums, including heaps past `memoryHeapCount`; - the DXGI fallback and Wine's all-zero answer; - this process's own private bytes; - a fake source in the window title, read at most once per refresh; - a HUD without its own source shows the figure a device published. - **`d3d12_vram_budget_test`** (new; registered with `SKIP_RETURN_CODE 77`): - the standalone device enables the extension exactly when the GPU lists it; - the device publishes its figure while it lives and withdraws it on release; - with a 64 MiB buffer alive, the budget is non-zero: on the iGPU, 271 MiB in use of 21 471 MiB device-local; - without the extension, it checks that the figure is `n/a` and skips. - **Failing without the change:** the new checks call `memory_figures.h` and read the overlay's seventh line, so they fail or do not build without it. - **Full Windows suite under Wine** (clang-cl + xwin build), compared with the `main` baseline: - lavapipe: 410 pass, 12 fail, 40 skip (baseline 393 pass, 12 fail); - RADV iGPU: 403 pass, 20 fail, 39 skip (baseline 386 pass, 20 fail); - verdict: no test went from pass to fail; 17 tests went `absent -> pass` on each device: `d3d12_vram_budget`, `title_hud`, `dev_overlay` and 14 from merges since the baseline. - The remaining failures fail the same way in the baseline. They are environment-only (bcrypt, file system, gameinput host, root signature, clears, present/swapchain, pipeline cache seed). - **Other checks:** `tests/test_docs_*.py`, `test_text_write_line_endings.py`, `test_ci_registration.py`, `test_ctest_registration.py` and `scripts/check_no_game_data.py` on the changed files all pass. - **Not tested:** Windows itself, and the game. The overlay window was not watched on screen; its text is the tested pure function. GPUs tested: lavapipe (Mesa 26.3.1) and AMD Radeon iGPU gfx1036 (RADV, Mesa 26.3.1), Wine 11.22 (Staging) on Arch Linux. Both expose `VK_EXT_memory_budget`. AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
The title HUD (#1922, LEONIDA_TITLE_HUD=1) read VRAM from DXGI's
QueryVideoMemoryInfo on the host dxgi.dll and private memory from
PROCESS_MEMORY_COUNTERS_EX::PrivateUsage. Under Wine both read 0.

- VRAM: the runtime's device enables VK_EXT_memory_budget when the GPU
  has it (VulkanDeviceInfo::memory_budget), and
  rt::d3d12::vulkan_vram_budget sums heapUsage and heapBudget over the
  DEVICE_LOCAL heaps (other heaps' usage shown as shared), from
  src/vulkan_memory_budget.h. The HUD calls it once per refresh on its
  own thread. Without the extension it falls back to DXGI, and where
  that has no figure either it shows "VRAM n/a" rather than 0.
- Private memory: Wine's GetProcessMemoryInfo fills only the
  PROCESS_MEMORY_COUNTERS part and leaves PrivateUsage 0; PagefileUsage
  is the same commit-charge figure on Windows 8 and later, so the HUD
  takes the larger of the two.

Tests: title_hud_test checks the sums, the DXGI fallback, the "n/a"
text and the private-bytes choice with made-up values, and that a VRAM
source reaches the title at most once per refresh. The new
d3d12_vram_budget_test checks that the device enables the extension
exactly when the GPU has it and reads a non-zero budget, and skips
(77) without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in #2137 (LEONIDA_DEV_OVERLAY), which the next commit extends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
LEONIDA_DEV_OVERLAY (#2137) showed the working set and free RAM, with
no GPU memory and no private memory. It now shows both, from the same
code as the title HUD:

- src/memory_figures.h holds VramBudget, the private-bytes choice (the
  larger of PrivateUsage and PagefileUsage, since Wine fills only the
  latter), the "RAM ..." and "VRAM ..." text with "n/a" where there is
  no figure, and a publisher for the device's GPU memory figure. No
  Vulkan, and Win32 only under _WIN32, so the overlay's test still
  builds on every host.
- A device with VK_EXT_memory_budget publishes a reader when it is
  created and withdraws it first thing when it is destroyed (the lock
  is held during a read, so a reader never outlives its device).
  latest_vram() calls the reader at most once per 500 ms for both
  views. The HUD reads it instead of its own per-device lambda.
- The overlay's last line is now "RAM 2.5 GB (ws 1.0)   VRAM
  3.5/16.0 GB +0.5 shared"; cores and free RAM keep their own line.

Tests: dev_overlay_test checks the text with and without figures, the
private-bytes fallback, and the publisher (one read per refresh, only
the publishing device withdraws). title_hud_test checks that a HUD
without its own source shows the published figure.
d3d12_vram_budget_test checks that the device publishes its figure
while it lives and withdraws it on release.

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

@⁠aslan2142 on GitHub · 2026-11-25 23:21 UTC · original

Merged. The title HUD (#1922) and the dev overlay (#2137) now show real memory figures under Wine.

  • VRAM: from VK_EXT_memory_budget on the runtime's own device: used and budget over the device-local heaps, plus what the other heaps use as shared. It is read at most once per 500 ms for both views, and shows n/a without the extension instead of a false 0.
  • Private memory: the larger of PrivateUsage and PagefileUsage, since Wine leaves the first at 0; n/a when neither can be read.
  • One helper: runtime/src/memory_figures.h feeds both the HUD and the overlay. The device publishes its figure when it is created and withdraws it first thing on release.
  • Tested: the full Windows suite under Wine on llvmpipe and the RADV gfx1036 iGPU, merged onto main ffcfe68f1 (with #2137): no test went from pass to fail, and dev_overlay, title_hud and d3d12_vram_budget pass on both. Not yet run on Windows itself or with the game.
  • Checked on main ffcfe68f1 + 38385762b: it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 12 changed files.

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

**@⁠aslan2142** on GitHub · 2026-11-25 23:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2128#issuecomment-7177444065) Merged. The title HUD (#1922) and the dev overlay (#2137) now show real memory figures under Wine. - **VRAM:** from `VK_EXT_memory_budget` on the runtime's own device: used and budget over the device-local heaps, plus what the other heaps use as shared. It is read at most once per 500 ms for both views, and shows `n/a` without the extension instead of a false 0. - **Private memory:** the larger of `PrivateUsage` and `PagefileUsage`, since Wine leaves the first at 0; `n/a` when neither can be read. - **One helper:** `runtime/src/memory_figures.h` feeds both the HUD and the overlay. The device publishes its figure when it is created and withdraws it first thing on release. - **Tested:** the full Windows suite under Wine on llvmpipe and the RADV gfx1036 iGPU, merged onto `main` `ffcfe68f1` (with #2137): no test went from pass to fail, and `dev_overlay`, `title_hud` and `d3d12_vram_budget` pass on both. Not yet run on Windows itself or with the game. - **Checked on `main` `ffcfe68f1` + `38385762b`:** it merges cleanly; the semantic suite passes (493 files, 6,318 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 12 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.