mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 11:49:59 -04:00
Break the memory report down past VMA, by owner in system memory, and by growth over a session.
Every report adds a line for video memory outside VMA (the driver's usage and budget per heap against VMA's blocks, and counts of pipelines by kind and by last use, stage libraries, compute pipelines, layouts and descriptor pools, with the swapchain, DLSS and FSR sizes), a line that splits the process's commit by owner (the game's heap and maps, device-local memory, VMA's host blocks, the C runtime heap with the shader caches, pipeline tables, texture cache, log queue and flight recorder in it, the driver's pipeline cache data and the rest), and a line naming what grew by more than 64 MiB since the report before and since play began. Every ten minutes of play and at exit a ranking line orders the categories by growth and marks those that only climbed; tests/mem_growth_check.py checks that bookkeeping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ extern "C" int vk_ffx4_holds(void) { return 0; }
|
||||
extern "C" int vk_ffx4_failed(void) { return 0; }
|
||||
extern "C" void vk_ffx4_retry(void) {}
|
||||
extern "C" void vk_ffx4_trim(uint64_t) {}
|
||||
extern "C" uint64_t vk_ffx4_vram(int *contexts) { return *contexts = 0, 0; }
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <atomic>
|
||||
@@ -196,6 +197,7 @@ struct Up {
|
||||
ffxCreateBackendVKDesc backend = {};
|
||||
ffxOverrideVersion version = {};
|
||||
ffxCreateContextDescUpscaleVersion built = {};
|
||||
uint64_t vram = 0; // its video memory as the library reported it at its creation
|
||||
} U[4];
|
||||
uint64_t up_tick;
|
||||
const uint64_t UP_RECENT = 8; // contexts used this recently may sit in a command buffer not submitted yet
|
||||
@@ -260,6 +262,7 @@ Up *create(Up *slot, uint32_t mw, uint32_t mh, uint32_t ow, uint32_t oh, bool dr
|
||||
mq.header.type = FFX_API_QUERY_DESC_TYPE_UPSCALE_GPU_MEMORY_USAGE;
|
||||
mq.gpuMemoryUsageUpscaler = &mem;
|
||||
A.query(&slot->ctx, &mq.header);
|
||||
slot->vram = mem.totalUsageInBytes;
|
||||
rt_log("ffx4: FSR %s upscaling to %ux%u from render sizes up to %ux%u, made in %.0f ms, %.0f MiB of video memory",
|
||||
v.versionName ? v.versionName : "4", ow, oh, mw, mh, (double)(plat_now_ns() - t0) / 1e6,
|
||||
(double)mem.totalUsageInBytes / 1048576.0);
|
||||
@@ -446,4 +449,14 @@ extern "C" void vk_ffx4_release(void) {
|
||||
for (Up &u : U)
|
||||
if (u.ctx) A.destroy(&u.ctx, nullptr), u = Up();
|
||||
}
|
||||
|
||||
// FSR 4's upscaling contexts that exist and their video memory, for the memory report (vk_ffx.cpp vk_ffx_vram).
|
||||
extern "C" uint64_t vk_ffx4_vram(int *contexts) {
|
||||
uint64_t bytes = 0;
|
||||
int n = 0;
|
||||
for (Up &u : U)
|
||||
if (__atomic_load_n(&u.ctx, __ATOMIC_RELAXED)) n++, bytes += __atomic_load_n(&u.vram, __ATOMIC_RELAXED);
|
||||
*contexts = n;
|
||||
return bytes;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
Reference in New Issue
Block a user