vk: Refactor the vram exhausted handler

- Mostly a de-uglify pass
This commit is contained in:
kd-11 2023-05-13 02:36:11 +03:00 committed by kd-11
parent 9a2b06f35f
commit 29d87a3743

View file

@ -1122,10 +1122,9 @@ bool VKGSRender::on_vram_exhausted(rsx::problem_severity severity)
}
bool surface_cache_relieved = false;
if (severity >= rsx::problem_severity::moderate)
{
// Check if we need to spill
const auto mem_info = m_device->get_memory_mapping();
// Check if we need to spill
if (severity >= rsx::problem_severity::fatal && // Only spill for fatal errors
mem_info.device_local != mem_info.host_visible_coherent && // Do not spill if it is an IGP, there is nowhere to spill to
m_rtts.is_overallocated()) // Surface cache must be over-allocated by the design quota
@ -1141,7 +1140,14 @@ bool VKGSRender::on_vram_exhausted(rsx::problem_severity severity)
m_rtts.free_invalidated(*m_current_command_buffer, severity);
}
if (severity >= rsx::problem_severity::fatal && surface_cache_relieved && !m_samplers_dirty)
const bool any_cache_relieved = (texture_cache_relieved || surface_cache_relieved);
if (severity <= rsx::problem_severity::moderate)
{
return any_cache_relieved;
}
ensure(severity >= rsx::problem_severity::fatal);
if (surface_cache_relieved && !m_samplers_dirty)
{
// If surface cache was modified destructively, then we must reload samplers touching the surface cache.
bool invalidate_samplers = false;
@ -1164,14 +1170,9 @@ bool VKGSRender::on_vram_exhausted(rsx::problem_severity severity)
m_samplers_dirty.store(true);
}
}
}
const bool any_cache_relieved = (texture_cache_relieved || surface_cache_relieved);
if (severity >= rsx::problem_severity::fatal)
{
// Imminent crash, full GPU sync is the least of our problems
flush_command_queue(true, true);
}
return any_cache_relieved;
}