aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Pool.cs19
-rw-r--r--Ryujinx.Graphics.Gpu/Image/SamplerPool.cs6
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureCache.cs12
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TexturePool.cs5
4 files changed, 23 insertions, 19 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs
index a06a7ccf..f54ce1d7 100644
--- a/Ryujinx.Graphics.Gpu/Image/Pool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs
@@ -15,6 +15,7 @@ namespace Ryujinx.Graphics.Gpu.Image
protected GpuContext Context;
protected PhysicalMemory PhysicalMemory;
+ protected int SequenceNumber;
protected T1[] Items;
protected T2[] DescriptorCache;
@@ -64,6 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Image
Size = size;
_memoryTracking = physicalMemory.BeginGranularTracking(address, size);
+ _memoryTracking.RegisterPreciseAction(address, size, PreciseAction);
_modifiedDelegate = RegionModified;
}
@@ -116,6 +118,23 @@ namespace Ryujinx.Graphics.Gpu.Image
InvalidateRangeImpl(mAddress, mSize);
}
+ /// <summary>
+ /// An action to be performed when a precise memory access occurs to this resource.
+ /// Makes sure that the dirty flags are checked.
+ /// </summary>
+ /// <param name="address">Address of the memory action</param>
+ /// <param name="size">Size in bytes</param>
+ /// <param name="write">True if the access was a write, false otherwise</param>
+ private bool PreciseAction(ulong address, ulong size, bool write)
+ {
+ if (write && Context.SequenceNumber == SequenceNumber)
+ {
+ SequenceNumber--;
+ }
+
+ return false;
+ }
+
protected abstract void InvalidateRangeImpl(ulong address, ulong size);
protected abstract void Delete(T1 item);
diff --git a/Ryujinx.Graphics.Gpu/Image/SamplerPool.cs b/Ryujinx.Graphics.Gpu/Image/SamplerPool.cs
index aed6cb9c..5a84bd84 100644
--- a/Ryujinx.Graphics.Gpu/Image/SamplerPool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/SamplerPool.cs
@@ -7,8 +7,6 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
class SamplerPool : Pool<Sampler, SamplerDescriptor>
{
- private int _sequenceNumber;
-
/// <summary>
/// Constructs a new instance of the sampler pool.
/// </summary>
@@ -30,9 +28,9 @@ namespace Ryujinx.Graphics.Gpu.Image
return null;
}
- if (_sequenceNumber != Context.SequenceNumber)
+ if (SequenceNumber != Context.SequenceNumber)
{
- _sequenceNumber = Context.SequenceNumber;
+ SequenceNumber = Context.SequenceNumber;
SynchronizeMemory();
}
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
index cc6867a6..1aa09b90 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
@@ -100,18 +100,6 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Determines if any texture exists within the target memory range.
- /// </summary>
- /// <param name="memoryManager">The GPU memory manager</param>
- /// <param name="gpuVa">GPU virtual address to search for textures</param>
- /// <param name="size">The size of the range</param>
- /// <returns>True if any texture exists in the range, false otherwise</returns>
- public bool IsTextureInRange(MemoryManager memoryManager, ulong gpuVa, ulong size)
- {
- return _textures.FindOverlaps(memoryManager.GetPhysicalRegions(gpuVa, size), ref _textureOverlaps) != 0;
- }
-
- /// <summary>
/// Determines if a given texture is "safe" for upscaling from its info.
/// Note that this is different from being compatible - this elilinates targets that would have detrimental effects when scaled.
/// </summary>
diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
index 5b5c5ab0..66cd9d4d 100644
--- a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
@@ -12,7 +12,6 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
class TexturePool : Pool<Texture, TextureDescriptor>
{
- private int _sequenceNumber;
private readonly GpuChannel _channel;
private readonly ConcurrentQueue<Texture> _dereferenceQueue = new ConcurrentQueue<Texture>();
@@ -45,9 +44,9 @@ namespace Ryujinx.Graphics.Gpu.Image
return null;
}
- if (_sequenceNumber != Context.SequenceNumber)
+ if (SequenceNumber != Context.SequenceNumber)
{
- _sequenceNumber = Context.SequenceNumber;
+ SequenceNumber = Context.SequenceNumber;
SynchronizeMemory();
}