Log the memory by owner every 3600 frames, and how often released textures come back.

Every VMA allocation is counted under the file that made it until it is freed, so the new "mem: by owner" line
splits the device-local memory the driver reports into textures (live, GPU-drawn, idle, released, released too
lately to drop), pools and VRAM mirrors, upscalers, replay buffers, uniform snapshots, the device address table,
the ASTC decoder, present and post-processing, headroom spares, the free space inside VMA's blocks and what VMA
never allocated. "mem: host" gives the host-visible allocations, the process's commit and working set and the
game's heap. "vk: released textures" counts take-backs by how long the texture was released and textures made
again after a drop by a bound or a pressure, with the drop's reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 23:10:09 -05:00
parent 4f80dbcbc2
commit 2820781fb7
7 changed files with 302 additions and 30 deletions

View File

@@ -38,9 +38,10 @@ void rt_log(const char *fmt, ...) {
static const uint32_t *table; // the first buffer vk_gpa.c creates
static uintptr_t next_handle = 0x1000;
VkResult vmaCreateBuffer(VmaAllocator a, const VkBufferCreateInfo *bi, const VmaAllocationCreateInfo *ai, VkBuffer *buf,
VmaAllocation *alloc, VmaAllocationInfo *info) {
(void)a, (void)ai;
// vk.h sends vmaCreateBuffer and vmaDestroyBuffer to these wrappers (vk_vma_budget.c)
VkResult vk_vma_create_buffer(VmaAllocator a, const VkBufferCreateInfo *bi, const VmaAllocationCreateInfo *ai, VkBuffer *buf,
VmaAllocation *alloc, VmaAllocationInfo *info, const char *file) {
(void)a, (void)ai, (void)file;
void *mem = calloc(1, (size_t)bi->size);
if (!table) table = mem;
*buf = (VkBuffer)(next_handle += 0x1000);