mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-03-11 17:45:43 +00:00
Merge branch 'fix/texture-cache' into 'master'
Increase texture cache @ 4 GiB DRAM for higher VRAM cards See merge request [ryubing/ryujinx!241](https://git.ryujinx.app/ryubing/ryujinx/-/merge_requests/241)
This commit is contained in:
commit
85a7e7d5cd
1 changed files with 12 additions and 18 deletions
|
|
@ -52,6 +52,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
private ulong MaxTextureSizeCapacity = 4UL * GiB;
|
private ulong MaxTextureSizeCapacity = 4UL * GiB;
|
||||||
private const ulong MinTextureSizeCapacity = 512 * 1024 * 1024;
|
private const ulong MinTextureSizeCapacity = 512 * 1024 * 1024;
|
||||||
private const ulong DefaultTextureSizeCapacity = 1 * GiB;
|
private const ulong DefaultTextureSizeCapacity = 1 * GiB;
|
||||||
|
private const ulong TextureSizeCapacity4GiB = 2 * GiB;
|
||||||
private const ulong TextureSizeCapacity6GiB = 4 * GiB;
|
private const ulong TextureSizeCapacity6GiB = 4 * GiB;
|
||||||
private const ulong TextureSizeCapacity8GiB = 6 * GiB;
|
private const ulong TextureSizeCapacity8GiB = 6 * GiB;
|
||||||
private const ulong TextureSizeCapacity12GiB = 12 * GiB;
|
private const ulong TextureSizeCapacity12GiB = 12 * GiB;
|
||||||
|
|
@ -73,31 +74,24 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If the backend GPU has 0 memory capacity, the cache size defaults to `DefaultTextureSizeCapacity`.
|
/// If the backend GPU has 0 memory capacity, the cache size defaults to `DefaultTextureSizeCapacity`.
|
||||||
///
|
///
|
||||||
/// Reads the current Device total CPU Memory, to determine the maximum amount of Vram available. Capped to 50% of Current GPU Memory.
|
/// Reads the current Device total CPU Memory, to determine the maximum amount of VRAM available. Capped to 50% of Current GPU Memory.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="context">The GPU context that the cache belongs to</param>
|
/// <param name="context">The GPU context that the cache belongs to</param>
|
||||||
/// <param name="cpuMemorySize">The amount of physical CPU Memory Avaiable on the device.</param>
|
/// <param name="cpuMemorySize">The amount of physical CPU Memory available on the device.</param>
|
||||||
public void Initialize(GpuContext context, ulong cpuMemorySize)
|
public void Initialize(GpuContext context, ulong cpuMemorySize)
|
||||||
{
|
{
|
||||||
ulong cpuMemorySizeGiB = cpuMemorySize / GiB;
|
ulong cpuMemorySizeGiB = cpuMemorySize / GiB;
|
||||||
|
ulong MaximumGpuMemoryGiB = context.Capabilities.MaximumGpuMemory / GiB;
|
||||||
|
|
||||||
if (cpuMemorySizeGiB < 6 || context.Capabilities.MaximumGpuMemory == 0)
|
MaxTextureSizeCapacity = cpuMemorySizeGiB switch
|
||||||
{
|
{
|
||||||
_maxCacheMemoryUsage = DefaultTextureSizeCapacity;
|
< 6 when MaximumGpuMemoryGiB < 6 || context.Capabilities.MaximumGpuMemory == 0 =>
|
||||||
return;
|
DefaultTextureSizeCapacity,
|
||||||
}
|
< 6 => TextureSizeCapacity4GiB,
|
||||||
else if (cpuMemorySizeGiB == 6)
|
6 => TextureSizeCapacity6GiB,
|
||||||
{
|
8 => TextureSizeCapacity8GiB,
|
||||||
MaxTextureSizeCapacity = TextureSizeCapacity6GiB;
|
_ => TextureSizeCapacity12GiB
|
||||||
}
|
};
|
||||||
else if (cpuMemorySizeGiB == 8)
|
|
||||||
{
|
|
||||||
MaxTextureSizeCapacity = TextureSizeCapacity8GiB;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MaxTextureSizeCapacity = TextureSizeCapacity12GiB;
|
|
||||||
}
|
|
||||||
|
|
||||||
ulong cacheMemory = (ulong)(context.Capabilities.MaximumGpuMemory * MemoryScaleFactor);
|
ulong cacheMemory = (ulong)(context.Capabilities.MaximumGpuMemory * MemoryScaleFactor);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue