mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
vk: Add overallocation quota for texture cache
This commit is contained in:
parent
5f6d1644cf
commit
09f9f21261
2 changed files with 33 additions and 0 deletions
|
@ -1214,4 +1214,35 @@ namespace vk
|
|||
{
|
||||
return m_temporary_memory_size;
|
||||
}
|
||||
|
||||
bool texture_cache::is_overallocated() const
|
||||
{
|
||||
const auto total_device_memory = m_device->get_memory_mapping().device_local_total_bytes / 0x100000;
|
||||
u64 quota = 0;
|
||||
|
||||
if (total_device_memory >= 1024)
|
||||
{
|
||||
quota = std::min(3072ull, (total_device_memory * 40) / 100);
|
||||
}
|
||||
else if (total_device_memory >= 768)
|
||||
{
|
||||
quota = 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
quota = std::min(128ull, total_device_memory / 2);
|
||||
}
|
||||
|
||||
quota *= 0x100000;
|
||||
|
||||
if (const u64 texture_cache_pool_usage = vmm_get_application_pool_usage(VMM_ALLOCATION_POOL_TEXTURE_CACHE);
|
||||
texture_cache_pool_usage > quota)
|
||||
{
|
||||
rsx_log.warning("Texture cache is using %lluM of memory which exceeds the allocation quota of %lluM",
|
||||
texture_cache_pool_usage, quota);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,5 +504,7 @@ namespace vk
|
|||
u32 get_unreleased_textures_count() const override;
|
||||
|
||||
u32 get_temporary_memory_in_use() const;
|
||||
|
||||
bool is_overallocated() const;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue