From 7d3bbd3cf7c7c750c6cb7901f56302a00d4bcae3 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 20 Jul 2021 20:08:11 +0300 Subject: [PATCH] vk: Dynamically select panic boundaries based on resolution scale --- rpcs3/Emu/RSX/VK/VKResourceManager.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp index 1457f2b3b2..58c9198725 100644 --- a/rpcs3/Emu/RSX/VK/VKResourceManager.cpp +++ b/rpcs3/Emu/RSX/VK/VKResourceManager.cpp @@ -164,14 +164,18 @@ namespace vk const auto mem_info = get_current_renderer()->get_memory_mapping(); const auto local_memory_usage = vmm_get_application_memory_usage(mem_info.device_local); - constexpr u64 _1GB = (1024 * 0x100000); - if (local_memory_usage < (mem_info.device_local_total_bytes / 2) || // Less than 50% VRAM usage OR - (mem_info.device_local_total_bytes - local_memory_usage) > _1GB) // More than 1GiB of unallocated memory + constexpr u64 _1M = 0x100000; + const auto res_scale = rsx::get_resolution_scale(); + const auto mem_threshold_1 = static_cast(256 * res_scale * res_scale) * _1M; + const auto mem_threshold_2 = static_cast(64 * res_scale * res_scale) * _1M; + + if (local_memory_usage < (mem_info.device_local_total_bytes / 2) || // Less than 50% VRAM usage OR + (mem_info.device_local_total_bytes - local_memory_usage) > mem_threshold_1) // Enough to hold all required resources left { // Lower severity to avoid slowing performance too much load_severity = rsx::problem_severity::low; } - else if ((mem_info.device_local_total_bytes - local_memory_usage) > 512 * 0x100000) + else if ((mem_info.device_local_total_bytes - local_memory_usage) > mem_threshold_2) // Enough to hold basic resources like textures, buffers, etc { // At least 512MB left, do not overreact load_severity = rsx::problem_severity::moderate;