Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

MaxLastBreath
Copy link
Contributor

@MaxLastBreath MaxLastBreath commented Oct 22, 2024

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.

- If the device has less than 6GiB CPU Ram it'll default to : DefaultTextureSizeCapacity
- for 8GiB CPU ram it'll cap to allowed 6GiB VRAM allocated
- for 6GiB CPU ram it'll cap to allowed 4GiB VRAM allocated
- for 12GiB CPU ram it'll cap to allowed 12GiB VRAM allocated
@github-actions github-actions bot added gpu Affects GPU emulation horizon Affects the Horizon OS HLE components. labels Oct 22, 2024
@KeatonTheBot
Copy link
Contributor

KeatonTheBot commented Oct 26, 2024

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;
  }

@Maskworkr
Copy link

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

Testing on luigi mansions 3, no crashes

@MaxLastBreath
Copy link
Contributor Author

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.

Otozinclus pushed a commit to Otozinclus/Ryujinx that referenced this pull request Oct 30, 2024
Separate samplers are now supported and arrays in constant sets are bound
@GreemDev GreemDev merged commit 9305d17 into GreemDev:master Nov 1, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gpu Affects GPU emulation horizon Affects the Horizon OS HLE components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants