mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 21:39:58 -04:00
Keep no spare block of video memory past a budget cap set for a test.
The headroom thread compared a heap's use with the driver's budget alone, so a run with NX2NAVI_VRAM_BUDGET_MB kept its spare blocks where the card the cap stands for keeps none, and such a run understated a small card (the audit's F-3-07). With a cap set, the device-local use is now also compared with 85 % of the capped budget, the figure the mirrors and the textures go by. Without a cap nothing changes: each heap's own figure decides as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -125,7 +125,16 @@ static int room(const VkCtx *c, uint32_t type, VkDeviceSize block) {
|
||||
VmaBudget b[VK_MAX_MEMORY_HEAPS];
|
||||
vmaGetHeapBudgets(c->vma, b);
|
||||
const VmaBudget *h = &b[c->mem_props.memoryTypes[type].heapIndex];
|
||||
return h->budget && h->usage + 2 * block <= h->budget / 100 * 85;
|
||||
if (!h->budget || h->usage + 2 * block > h->budget / 100 * 85) return 0;
|
||||
// A budget taken as smaller for a test (NX2NAVI_VRAM_BUDGET_MB, vk_mem_vram) is what the mirrors and the textures
|
||||
// go by; measured against the driver's budget alone, a capped run kept its spare blocks where the card it stands
|
||||
// for keeps none. Only then: without a cap the heap's own figure above decides, heap by heap.
|
||||
uint64_t all = 0, used, capped;
|
||||
int exact;
|
||||
for (uint32_t i = 0; i < c->mem_props.memoryHeapCount && i < VK_MAX_MEMORY_HEAPS; i++)
|
||||
if (c->mem_props.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) all += b[i].budget;
|
||||
if (vk_mem_vram(&used, &capped, &exact) && capped < all && used + 2 * block > capped / 100 * 85) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void drop_anchor(const VkCtx *c, uint32_t type) {
|
||||
|
||||
Reference in New Issue
Block a user