4 Commits

Author SHA1 Message Date
38385762bd dev overlay: the title HUD's VRAM and private memory figures
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 <noreply@anthropic.com>
2026-11-25 18:18:57 -05:00
244387529b title HUD: VRAM from VK_EXT_memory_budget, private bytes under Wine
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 <noreply@anthropic.com>
2026-11-25 16:56:01 -05:00
1c5e2dcab1 title HUD: with no frame in an interval, show how long since the last one
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 <noreply@anthropic.com>
2026-11-25 21:01:18 +05:00
e86b3ceaa8 d3d12_xs: LEONIDA_TITLE_HUD shows frame rate, memory and pipeline compiles in the window's title bar (RT-TITLE-HUD)
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 <noreply@anthropic.com>
2026-11-25 20:51:50 +05:00