Only enumerate cached textures that are modified when flushing. (#918)

* Only enumarate cached textures that are modified when flushing, rather than all of them.

* Remove locking.

* Add missing clear.

* Remove texture from modified list when data is disposed.

In case the game does not call either flush method at any point.

* Add ReferenceEqualityComparer from jD for the HashSet
This commit is contained in:
riperiperi 2020-02-06 21:49:26 +00:00 committed by GitHub
parent a906f2071c
commit 6db16b4110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 13 deletions

View file

@ -54,9 +54,14 @@ namespace Ryujinx.Graphics.Gpu.Image
public LinkedListNode<Texture> CacheNode { get; set; }
/// <summary>
/// Texture data modified by the GPU.
/// Event to fire when texture data is modified by the GPU.
/// </summary>
public bool Modified { get; set; }
public event Action<Texture> Modified;
/// <summary>
/// Event to fire when texture data is disposed.
/// </summary>
public event Action<Texture> Disposed;
/// <summary>
/// Start address of the texture in guest memory.
@ -933,6 +938,14 @@ namespace Ryujinx.Graphics.Gpu.Image
_layers = info.GetLayers();
}
/// <summary>
/// Signals that the texture has been modified.
/// </summary>
public void SignalModified()
{
Modified?.Invoke(this);
}
/// <summary>
/// Replaces the host texture, while disposing of the old one if needed.
/// </summary>
@ -1012,6 +1025,8 @@ namespace Ryujinx.Graphics.Gpu.Image
_arrayViewTexture?.Dispose();
_arrayViewTexture = null;
Disposed?.Invoke(this);
}
/// <summary>