mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 04:49:57 -04:00
Give back the kept staging and snapshot buffers and the spare blocks when an allocation is refused, then try once more.
A staging buffer, a transient buffer of the replay or a descriptor pool that the driver refuses for memory used to end the game at once. Now the buffers kept for reuse go back to the driver first: the staging cache, the staging arena's free chunks, the write-back snapshot pool and the headroom's spare blocks (no new spare block for 30 s after that), and the allocation is tried once more; only a second refusal ends the game. On integrated GPUs the device-local heap is the machine's RAM and fills before the commit checks see anything: staging buffers of 11 KiB to 16 MiB refused there ended the game in Hyrule Field and on the first scene of play (#465, #567). NX2NAVI_STAGING_FAIL_AT=n (diagnostics) takes the n-th staging buffer as refused once, to test the path. Check: a Kakariko run with NX2NAVI_STAGING_FAIL_AT=300 logged "staging buffer of 524288 bytes refused (-2): 348.2 MiB of kept buffers and spare blocks given back, made at the second try" and played on to the end of its script. The transient buffer and descriptor pool paths call the same give-back and were not forced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -390,6 +390,10 @@ const VmaDeviceMemoryCallbacks *vk_headroom_callbacks(void);
|
||||
void vk_headroom_start(void);
|
||||
void vk_headroom_stop(void); // before vmaDestroyAllocator
|
||||
uint64_t vk_headroom_held(void); // bytes the spare blocks' anchors hold
|
||||
uint64_t vk_headroom_release(void); // a refused allocation: the anchors go, none for 30 s; returns their bytes
|
||||
// A refused allocation: the staging and snapshot buffers kept for reuse and the headroom's spare blocks go back to the
|
||||
// driver before the caller tries once more (vk_memory.c). Returns the bytes.
|
||||
uint64_t vk_mem_give_back(void);
|
||||
VkDeviceSize vk_vma_block_size(void); // VMA's block size on heaps over 1 GiB (NX2NAVI_VMA_BLOCK_MB)
|
||||
int vk_mem_resolve(uint64_t addr, uint64_t size, VkMemSpan *out); // 1 when all of [addr, addr+size) is backed
|
||||
// vk_mem_resolve for a caller that reads guest memory itself or only asks what backs it: with shadow storage the pool
|
||||
|
||||
Reference in New Issue
Block a user