From a6b9ca1b5b9a0343fd27f90cdcad850aa06afd6e Mon Sep 17 00:00:00 2001 From: KeatonTheBot Date: Sat, 27 Dec 2025 22:05:51 -0600 Subject: [PATCH] Increase texture cache @ 4 GiB DRAM for higher VRAM cards --- .../Image/AutoDeleteCache.cs | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs b/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs index 99b34112f..8ac4e6304 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs @@ -52,6 +52,7 @@ namespace Ryujinx.Graphics.Gpu.Image private ulong MaxTextureSizeCapacity = 4UL * GiB; private const ulong MinTextureSizeCapacity = 512 * 1024 * 1024; private const ulong DefaultTextureSizeCapacity = 1 * GiB; + private const ulong TextureSizeCapacity4GiB = 2 * GiB; private const ulong TextureSizeCapacity6GiB = 4 * GiB; private const ulong TextureSizeCapacity8GiB = 6 * GiB; private const ulong TextureSizeCapacity12GiB = 12 * GiB; @@ -73,31 +74,24 @@ namespace Ryujinx.Graphics.Gpu.Image /// /// 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. /// /// The GPU context that the cache belongs to - /// The amount of physical CPU Memory Avaiable on the device. + /// The amount of physical CPU Memory available on the device. public void Initialize(GpuContext context, ulong cpuMemorySize) { ulong cpuMemorySizeGiB = cpuMemorySize / GiB; + ulong MaximumGpuMemoryGiB = context.Capabilities.MaximumGpuMemory / GiB; - if (cpuMemorySizeGiB < 6 || context.Capabilities.MaximumGpuMemory == 0) + MaxTextureSizeCapacity = cpuMemorySizeGiB switch { - _maxCacheMemoryUsage = DefaultTextureSizeCapacity; - return; - } - else if (cpuMemorySizeGiB == 6) - { - MaxTextureSizeCapacity = TextureSizeCapacity6GiB; - } - else if (cpuMemorySizeGiB == 8) - { - MaxTextureSizeCapacity = TextureSizeCapacity8GiB; - } - else - { - MaxTextureSizeCapacity = TextureSizeCapacity12GiB; - } + < 6 when MaximumGpuMemoryGiB < 6 || context.Capabilities.MaximumGpuMemory == 0 => + DefaultTextureSizeCapacity, + < 6 => TextureSizeCapacity4GiB, + 6 => TextureSizeCapacity6GiB, + 8 => TextureSizeCapacity8GiB, + _ => TextureSizeCapacity12GiB + }; ulong cacheMemory = (ulong)(context.Capabilities.MaximumGpuMemory * MemoryScaleFactor);