forked from Mirror/Ryujinx
Make TextureGroup.ClearModified thread safe (#6686)
This commit is contained in:
parent
2b6cc4b353
commit
2ef4f92b07
3 changed files with 16 additions and 10 deletions
|
@ -390,7 +390,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
{
|
{
|
||||||
_views.Remove(texture);
|
_views.Remove(texture);
|
||||||
|
|
||||||
Group.RemoveView(texture);
|
Group.RemoveView(_views, texture);
|
||||||
|
|
||||||
texture._viewStorage = texture;
|
texture._viewStorage = texture;
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
private MultiRange TextureRange => Storage.Range;
|
private MultiRange TextureRange => Storage.Range;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The views list from the storage texture.
|
/// The views array from the storage texture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<Texture> _views;
|
private Texture[] _views;
|
||||||
private TextureGroupHandle[] _handles;
|
private TextureGroupHandle[] _handles;
|
||||||
private bool[] _loadNeeded;
|
private bool[] _loadNeeded;
|
||||||
|
|
||||||
|
@ -1074,7 +1074,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
public void UpdateViews(List<Texture> views, Texture texture)
|
public void UpdateViews(List<Texture> views, Texture texture)
|
||||||
{
|
{
|
||||||
// This is saved to calculate overlapping views for each handle.
|
// This is saved to calculate overlapping views for each handle.
|
||||||
_views = views;
|
_views = views.ToArray();
|
||||||
|
|
||||||
bool layerViews = _hasLayerViews;
|
bool layerViews = _hasLayerViews;
|
||||||
bool mipViews = _hasMipViews;
|
bool mipViews = _hasMipViews;
|
||||||
|
@ -1136,9 +1136,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes a view from the group, removing it from all overlap lists.
|
/// Removes a view from the group, removing it from all overlap lists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="views">The views list of the storage texture</param>
|
||||||
/// <param name="view">View to remove from the group</param>
|
/// <param name="view">View to remove from the group</param>
|
||||||
public void RemoveView(Texture view)
|
public void RemoveView(List<Texture> views, Texture view)
|
||||||
{
|
{
|
||||||
|
// This is saved to calculate overlapping views for each handle.
|
||||||
|
_views = views.ToArray();
|
||||||
|
|
||||||
int offset = FindOffset(view);
|
int offset = FindOffset(view);
|
||||||
|
|
||||||
foreach (TextureGroupHandle handle in _handles)
|
foreach (TextureGroupHandle handle in _handles)
|
||||||
|
@ -1605,9 +1609,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
|
||||||
Storage.SignalModifiedDirty();
|
Storage.SignalModifiedDirty();
|
||||||
|
|
||||||
if (_views != null)
|
Texture[] views = _views;
|
||||||
|
|
||||||
|
if (views != null)
|
||||||
{
|
{
|
||||||
foreach (Texture texture in _views)
|
foreach (Texture texture in views)
|
||||||
{
|
{
|
||||||
texture.SignalModifiedDirty();
|
texture.SignalModifiedDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
public TextureGroupHandle(TextureGroup group,
|
public TextureGroupHandle(TextureGroup group,
|
||||||
int offset,
|
int offset,
|
||||||
ulong size,
|
ulong size,
|
||||||
List<Texture> views,
|
IEnumerable<Texture> views,
|
||||||
int firstLayer,
|
int firstLayer,
|
||||||
int firstLevel,
|
int firstLevel,
|
||||||
int baseSlice,
|
int baseSlice,
|
||||||
|
@ -201,8 +201,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
/// Calculate a list of which views overlap this handle.
|
/// Calculate a list of which views overlap this handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="group">The parent texture group, used to find a view's base CPU VA offset</param>
|
/// <param name="group">The parent texture group, used to find a view's base CPU VA offset</param>
|
||||||
/// <param name="views">The list of views to search for overlaps</param>
|
/// <param name="views">The views to search for overlaps</param>
|
||||||
public void RecalculateOverlaps(TextureGroup group, List<Texture> views)
|
public void RecalculateOverlaps(TextureGroup group, IEnumerable<Texture> views)
|
||||||
{
|
{
|
||||||
// Overlaps can be accessed from the memory tracking signal handler, so access must be atomic.
|
// Overlaps can be accessed from the memory tracking signal handler, so access must be atomic.
|
||||||
lock (Overlaps)
|
lock (Overlaps)
|
||||||
|
|
Reference in a new issue