vk: Fix 'grow' behavior when we reach the size limit

- Just swap out the current heap ptr and spawn a fresh one. Chances are, we can spare 1GB of host memory.
This commit is contained in:
kd-11 2022-01-28 17:39:45 +03:00 committed by kd-11
parent d063f0b335
commit 0e320d17c1

View File

@ -51,22 +51,24 @@ namespace vk
bool data_heap::grow(usz size)
{
// Create new heap. All sizes are aligned up by 64M, upto 1GiB
const usz size_limit = 1024 * 0x100000;
const usz aligned_new_size = utils::align(m_size + size, 64 * 0x100000);
if (aligned_new_size >= size_limit)
{
// Too large
return false;
}
if (shadow)
{
// Shadowed. Growing this can be messy as it requires double allocation (macOS only)
rsx_log.error("[%s] Auto-grow of shadowed heaps is not currently supported. This error should typically only be seen on MacOS.", m_name);
return false;
}
// Create new heap. All sizes are aligned up by 64M, upto 1GiB
const usz size_limit = 1024 * 0x100000;
usz aligned_new_size = utils::align(m_size + size, 64 * 0x100000);
if (aligned_new_size >= size_limit)
{
// Too large, try to swap out the heap instead of growing.
rsx_log.error("[%s] Pool limit was reached. Will attempt to swap out the current heap.", m_name);
aligned_new_size = size_limit;
}
// Wait for DMA activity to end
g_fxo->get<rsx::dma_manager>().sync();