aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs2
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Texture.cs4
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureCache.cs20
3 files changed, 17 insertions, 9 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs b/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
index 3c74c164..5077cb6a 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
@@ -127,6 +127,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
return;
}
+ memoryManager.Physical.TextureCache.Lift(srcTexture);
+
// When the source texture that was found has a depth format,
// we must enforce the target texture also has a depth format,
// as copies between depth and color formats are not allowed.
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs
index c9c3c59a..3a66960d 100644
--- a/Ryujinx.Graphics.Gpu/Image/Texture.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs
@@ -1235,6 +1235,8 @@ namespace Ryujinx.Graphics.Gpu.Image
IsModified = true;
Group.SignalModified(this, !wasModified);
}
+
+ _physicalMemory.TextureCache.Lift(this);
}
/// <summary>
@@ -1252,6 +1254,8 @@ namespace Ryujinx.Graphics.Gpu.Image
Group.SignalModifying(this, bound, !wasModified);
}
+ _physicalMemory.TextureCache.Lift(this);
+
if (bound)
{
IncrementReferenceCount();
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
index 44c974e8..ea64f46c 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
@@ -155,6 +155,17 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
+ /// Lifts the texture to the top of the AutoDeleteCache. This is primarily used to enforce that
+ /// data written to a target will be flushed to memory should the texture be deleted, but also
+ /// keeps rendered textures alive without a pool reference.
+ /// </summary>
+ /// <param name="texture">Texture to lift</param>
+ public void Lift(Texture texture)
+ {
+ _cache.Lift(texture);
+ }
+
+ /// <summary>
/// Tries to find an existing texture, or create a new one if not found.
/// </summary>
/// <param name="memoryManager">GPU memory manager where the texture is mapped</param>
@@ -442,14 +453,6 @@ namespace Ryujinx.Graphics.Gpu.Image
if (texture != null)
{
- if (!isSamplerTexture)
- {
- // If not a sampler texture, it is managed by the auto delete
- // cache, ensure that it is on the "top" of the list to avoid
- // deletion.
- _cache.Lift(texture);
- }
-
ChangeSizeIfNeeded(info, texture, isSamplerTexture, sizeHint);
texture.SynchronizeMemory();
@@ -849,7 +852,6 @@ namespace Ryujinx.Graphics.Gpu.Image
if (match)
{
- _cache.Lift(texture);
return texture;
}
}