Textures : Increase the amount of VRAM Cache available for Textures based on selected DRAM. #36

Merged
MaxLastBreath merged 2 commits from Vram-Changes-#2 into master 2024-11-01 11:46:29 +00:00
MaxLastBreath commented 2024-10-22 19:44:05 +00:00 (Migrated from github.com)

AutoCacheDelete Continuation of my previous Ryujinx commit from September on the Original Ryujinx Project.

  • If the device has less than 6GiB CPU Ram Allocated it'll default to : 1 GiB VRAM allocated
  • for 6GiB CPU ram it'll cap to allowed 4 GiB VRAM allocated
  • for 8GiB CPU ram it'll cap to allowed 6 GiB VRAM allocated
  • for 12GiB CPU ram it'll cap to allowed 12 GiB VRAM allocated
  • This also adds a log with the amount of VRAM allocated in GiB.

What these changes aim to Improve :

  • Fixes a crash on Luigi Mansion 3, due to the amount of VRAM the game uses, from the previous commit the game would crash at 2X or higher scaled resolution on GPUS with less than 12GB of VRAM. Using the 4GiB CPU Dram setting will now default to 1 GiB of VRAM eliminating issues such as this.
  • This change also doesn't affect Internal resolution mods, as they can only go up to 1440p with 4GiB of Dram.
  • Bumping the maximum amount of VRAM available for 8GiB DRAM should allow some 4k or higher internal resolution mods to run better on higher end GPU's, keep in mind the VRAM is still capped to 50% of the current GPU available Memory.
  • For 12GiB the cap has been made even higher, the 12GiB setting should only be used when using Resolution + Texture Mods or extreme Resolution mods, this is where more Texture VRAM can be beneficial on extremely high end GPU's.

Keep in mind these caps are still only the upper limit of what amount of VRAM can be allocated towards textures, as it'll always be capped to 50% of the GPU's Memory.

Side Notes:

  • DRAM Size context should be updated to factor in these changes in a later commit.
### AutoCacheDelete Continuation of my previous Ryujinx commit from September on the Original Ryujinx Project. - If the device has less than 6GiB CPU Ram Allocated it'll default to : 1 GiB VRAM allocated - for 6GiB CPU ram it'll cap to allowed 4 GiB VRAM allocated - for 8GiB CPU ram it'll cap to allowed 6 GiB VRAM allocated - for 12GiB CPU ram it'll cap to allowed 12 GiB VRAM allocated - This also adds a log with the amount of VRAM allocated in GiB. ## What these changes aim to Improve : - Fixes a crash on Luigi Mansion 3, due to the amount of VRAM the game uses, from the previous commit the game would crash at 2X or higher scaled resolution on GPUS with less than 12GB of VRAM. Using the 4GiB CPU Dram setting will now default to 1 GiB of VRAM eliminating issues such as this. - This change also doesn't affect Internal resolution mods, as they can only go up to 1440p with 4GiB of Dram. - Bumping the maximum amount of VRAM available for 8GiB DRAM should allow some 4k or higher internal resolution mods to run better on higher end GPU's, keep in mind the VRAM is still capped to 50% of the current GPU available Memory. - For 12GiB the cap has been made even higher, the 12GiB setting should only be used when using Resolution + Texture Mods or extreme Resolution mods, this is where more Texture VRAM can be beneficial on extremely high end GPU's. Keep in mind these caps are still only the upper limit of what amount of VRAM can be allocated towards textures, as it'll always be capped to 50% of the GPU's Memory. ### Side Notes: - DRAM Size context should be updated to factor in these changes in a later commit.
github-actions[bot] commented 2024-10-22 19:57:23 +00:00 (Migrated from github.com)
Download the artifacts for this pull request: * [ryujinx-Release-1.2.0+9b7ccd0-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090354369.zip) * [ryujinx-Release-1.2.0+9b7ccd0-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090360877.zip) * [ryujinx-Release-1.2.0+9b7ccd0-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090368783.zip) * [ryujinx-Release-1.2.0+9b7ccd0-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090377753.zip) <details><summary>GUI-less (SDL2)</summary> * [sdl2-ryujinx-headless-Release-1.2.0+9b7ccd0-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090354530.zip) * [sdl2-ryujinx-headless-Release-1.2.0+9b7ccd0-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090361527.zip) * [sdl2-ryujinx-headless-Release-1.2.0+9b7ccd0-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090368955.zip) * [sdl2-ryujinx-headless-Release-1.2.0+9b7ccd0-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090378017.zip) </details> <details><summary>Only for Developers</summary> * [ryujinx-Debug-1.2.0+9b7ccd0-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090354364.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+9b7ccd0-linux_arm64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090354524.zip) * [ryujinx-Debug-1.2.0+9b7ccd0-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090363330.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+9b7ccd0-linux_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090363482.zip) * [ryujinx-Debug-1.2.0+9b7ccd0-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090369694.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+9b7ccd0-macos_universal](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090369852.zip) * [ryujinx-Debug-1.2.0+9b7ccd0-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090378388.zip) * [sdl2-ryujinx-headless-Debug-1.2.0+9b7ccd0-win_x64](https://nightly.link/GreemDev/Ryujinx/actions/artifacts/2090378635.zip) </details>
KeatonTheBot commented 2024-10-26 17:18:35 +00:00 (Migrated from github.com)

Testing this on my 3080 Ti with Super Mario Party: Jamboree, it works as expected for 6/8/12 GiB, but it's not using enough VRAM at 4 GiB. Making the following adjustments fixes it for me, and it also ensures that all devices with 0 memory capacity default to DefaultTextureSizeCapacity.

In AutoDeleteCache.cs, add a constant for the following:

private const ulong TextureSizeCapacity4GiB = 2 * GiB;

Then use the following if/else statement:

if (context.Capabilities.MaximumGpuMemory == 0)
{
	_maxCacheMemoryUsage = DefaultTextureSizeCapacity;
	return;
}
else if (cpuMemorySizeGiB < 6)
{
	MaxTextureSizeCapacity = TextureSizeCapacity4GiB;
}
else if (cpuMemorySizeGiB == 6)
{
	MaxTextureSizeCapacity = TextureSizeCapacity6GiB;
}
else if (cpuMemorySizeGiB == 8)
{
	MaxTextureSizeCapacity = TextureSizeCapacity8GiB;
}
else
{
	MaxTextureSizeCapacity = TextureSizeCapacity12GiB;
  }
Testing this on my 3080 Ti with Super Mario Party: Jamboree, it works as expected for 6/8/12 GiB, but it's not using enough VRAM at 4 GiB. Making the following adjustments fixes it for me, and it also ensures that *all* devices with 0 memory capacity default to DefaultTextureSizeCapacity. In AutoDeleteCache.cs, add a constant for the following: ```cs private const ulong TextureSizeCapacity4GiB = 2 * GiB; ``` Then use the following if/else statement: ```cs if (context.Capabilities.MaximumGpuMemory == 0) { _maxCacheMemoryUsage = DefaultTextureSizeCapacity; return; } else if (cpuMemorySizeGiB < 6) { MaxTextureSizeCapacity = TextureSizeCapacity4GiB; } else if (cpuMemorySizeGiB == 6) { MaxTextureSizeCapacity = TextureSizeCapacity6GiB; } else if (cpuMemorySizeGiB == 8) { MaxTextureSizeCapacity = TextureSizeCapacity8GiB; } else { MaxTextureSizeCapacity = TextureSizeCapacity12GiB; } ```
Maskworkr commented 2024-10-26 18:08:26 +00:00 (Migrated from github.com)

Ryujinx_1.2.0+9b7ccd0_2024-10-26_14-03-57.log
imagen_2024-10-26_140807708

Testing on luigi mansions 3, no crashes

[Ryujinx_1.2.0+9b7ccd0_2024-10-26_14-03-57.log](https://github.com/user-attachments/files/17531548/Ryujinx_1.2.0%2B9b7ccd0_2024-10-26_14-03-57.log) ![imagen_2024-10-26_140807708](https://github.com/user-attachments/assets/344e0db6-5df6-49d7-a681-01f7e8ee5327) Testing on luigi mansions 3, no crashes
MaxLastBreath commented 2024-10-26 18:52:55 +00:00 (Migrated from github.com)

Testing this on my 3080 Ti with Super Mario Party: Jamboree, it works as expected for 6/8/12 GiB, but it's not using enough VRAM at 4 GiB. Making the following adjustments fixes it for me, and it also ensures that all devices with 0 memory capacity default to DefaultTextureSizeCapacity.

In AutoDeleteCache.cs, add a constant for the following:

private const ulong TextureSizeCapacity4GiB = 2 * GiB;

Then use the following if/else statement:

if (context.Capabilities.MaximumGpuMemory == 0)
{
	_maxCacheMemoryUsage = DefaultTextureSizeCapacity;
	return;
}
else if (cpuMemorySizeGiB < 6)
{
	MaxTextureSizeCapacity = TextureSizeCapacity4GiB;
}
else if (cpuMemorySizeGiB == 6)
{
	MaxTextureSizeCapacity = TextureSizeCapacity6GiB;
}
else if (cpuMemorySizeGiB == 8)
{
	MaxTextureSizeCapacity = TextureSizeCapacity8GiB;
}
else
{
	MaxTextureSizeCapacity = TextureSizeCapacity12GiB;
  }

As discussed in discord, this only affects 4K mods at 4GiB but that is already addressed under the 6GiB and 8GiB options, the reason 1024 is set for 4GiB is in order to allow lower end GPUs those with 4-6GiB of VRAM to be able to more freely upscale games and not run out of VRAM when doing so, this should fix upscaling issues with Luigi Mansion 3 on GPU's with lower than 12GiB of VRAM and others from the main and the OG Ryujinx project.

In the future, perhaps allowing mods to change the VRAM and RAM setting would be ideal, that way you will be able to force 6GiB from the mod itself.

> Testing this on my 3080 Ti with Super Mario Party: Jamboree, it works as expected for 6/8/12 GiB, but it's not using enough VRAM at 4 GiB. Making the following adjustments fixes it for me, and it also ensures that _all_ devices with 0 memory capacity default to DefaultTextureSizeCapacity. > > In AutoDeleteCache.cs, add a constant for the following: > > ```cs > private const ulong TextureSizeCapacity4GiB = 2 * GiB; > ``` > > Then use the following if/else statement: > > ```cs > if (context.Capabilities.MaximumGpuMemory == 0) > { > _maxCacheMemoryUsage = DefaultTextureSizeCapacity; > return; > } > else if (cpuMemorySizeGiB < 6) > { > MaxTextureSizeCapacity = TextureSizeCapacity4GiB; > } > else if (cpuMemorySizeGiB == 6) > { > MaxTextureSizeCapacity = TextureSizeCapacity6GiB; > } > else if (cpuMemorySizeGiB == 8) > { > MaxTextureSizeCapacity = TextureSizeCapacity8GiB; > } > else > { > MaxTextureSizeCapacity = TextureSizeCapacity12GiB; > } > ``` As discussed in discord, this only affects 4K mods at 4GiB but that is already addressed under the 6GiB and 8GiB options, the reason 1024 is set for 4GiB is in order to allow lower end GPUs those with 4-6GiB of VRAM to be able to more freely upscale games and not run out of VRAM when doing so, this should fix upscaling issues with Luigi Mansion 3 on GPU's with lower than 12GiB of VRAM and others from the main and the OG Ryujinx project. In the future, perhaps allowing mods to change the VRAM and RAM setting would be ideal, that way you will be able to force 6GiB from the mod itself.
Sign in to join this conversation.
No description provided.