aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/Texture.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2021-08-20 21:52:09 +0100
committerGitHub <noreply@github.com>2021-08-20 17:52:09 -0300
commitbdc1f91a5b459a25cb74de9895d0136cf29d220d (patch)
tree61b3d5fdf638cc8c4cf99bed04d7600c732ce92b /Ryujinx.Graphics.Gpu/Image/Texture.cs
parente0af248e6f96efe7009915935407fc809eb774a9 (diff)
Remove pool cache entries for incompatible overlapping textures (#2568)
This greatly reduces memory usage in games that aggressively reuse memory without removing dead textures from the pool, such as the Xenoblade games, UE3 games, and to a lesser extent, UE4/unity games. This change stops memory usage from ballooning in xenoblade and some other games. It will also reduce texture view/dependency complexity in some games - for example in MK8D it will reduce the number of surface copies between lighting cubemaps generated for actors. There shouldn't be any performance impact from doing this, though the deletion and creation of textures could be improved by improving the OpenGL texture storage cache, which is very simple and limited right now. This will be improved in future. Another potential error has been fixed with the texture cache, which could prevent data loss when data is interchangably written to textures from both the GPU and CPU. It was possible that the dirty flag for a texture would be consumed without the data being synchronized on next use, due to the old overlap check. This check no longer consumes the dirty flag. Please test a bunch of games to make sure they still work, and there are no performance regressions.
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Texture.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs
index e156ff5e..0a083ebc 100644
--- a/Ryujinx.Graphics.Gpu/Image/Texture.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs
@@ -252,7 +252,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (!isView)
{
// Don't update this texture the next time we synchronize.
- ConsumeModified();
+ CheckModified(true);
if (ScaleMode == TextureScaleMode.Scaled)
{
@@ -599,12 +599,13 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <summary>
/// Checks if the memory for this texture was modified, and returns true if it was.
- /// The modified flags are consumed as a result.
+ /// The modified flags are optionally consumed as a result.
/// </summary>
+ /// <param name="consume">True to consume the dirty flags and reprotect, false to leave them as is</param>
/// <returns>True if the texture was modified, false otherwise.</returns>
- public bool ConsumeModified()
+ public bool CheckModified(bool consume)
{
- return Group.ConsumeDirty(this);
+ return Group.CheckDirty(this, consume);
}
/// <summary>
@@ -634,7 +635,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
else
{
- Group.ConsumeDirty(this);
+ Group.CheckDirty(this, true);
SynchronizeFull();
}
}
@@ -698,7 +699,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
BlacklistScale();
- Group.ConsumeDirty(this);
+ Group.CheckDirty(this, true);
IsModified = false;