Hold less device memory that only costs the system's commit: a smaller released-texture cache, no spare blocks while commit is low, large images in memory of their own.

The driver charges device memory to the system's commit. A 32 GB PC lost the device at an area load with the
system at 61 of 65.5 GB committed, the game at 28 GB: 12.35 GB of VRAM in use, of it up to 1.3 GB in released
textures kept for reuse, 0.5 to 1.8 GB free inside VMA's blocks, and a spare 256 MiB block per memory type.
- Released textures keep a thirty-second of the installed memory (512 MiB to 2 GiB) instead of a sixteenth (1 to 4
  GiB); only those released STALE_FRAMES presents ago go, so the transient ones the game takes back stay.
- The headroom thread keeps no spare block while the system's commit is low (vk_texture_commit_low), as it already
  keeps none under VRAM pressure.
- A texture image of 32 MiB or more gets memory of its own (DEDICATED_MIN), so freeing it gives the memory back at
  once instead of leaving a hole in a shared block that the driver counts in full until the block empties.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-09 14:00:12 -05:00
parent 7a15c063ca
commit fbb6783664
3 changed files with 20 additions and 7 deletions

View File

@@ -520,6 +520,7 @@ typedef struct { uint64_t live, released, own_live, own_released, bytes_live, by
void vk_texture_census(VkTexCensus *s);
void vk_texture_census_log(uint64_t frame); // vk_memory.c vram_log: the live entries' memory by kind and format
void vk_texture_want_room(uint64_t bytes); // a VRAM mirror that did not fit: idle textures make that much room
int vk_texture_commit_low(void); // the system's commit was low at the last check (vk_texture.c)
// vk_mem_vram's device-local use less the free space inside VMA's blocks (vk_memory.c), for the evictions
int vk_mem_vram_live(uint64_t *used, uint64_t *budget);
void vk_texture_shutdown(void); // vk_mem_shutdown calls it