aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureGroup.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureGroup.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
index bfc1105c..be0abea2 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
@@ -236,7 +236,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Synchronize memory for a given texture.
+ /// Synchronize memory for a given texture.
/// If overlapping tracking handles are dirty, fully or partially synchronize the texture data.
/// </summary>
/// <param name="texture">The texture being used</param>
@@ -280,7 +280,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Evaluate if any copy dependencies need to be fulfilled. A few rules:
// If the copy handle needs to be synchronized, prefer our own state.
- // If we need to be synchronized and there is a copy present, prefer the copy.
+ // If we need to be synchronized and there is a copy present, prefer the copy.
if (group.NeedsCopy && group.Copy(_context))
{
@@ -618,7 +618,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Evaluate the range of tracking handles which a view texture overlaps with,
+ /// Evaluate the range of tracking handles which a view texture overlaps with,
/// using the view's position and slice/level counts.
/// </summary>
/// <param name="firstLayer">The first layer of the texture</param>
@@ -879,7 +879,7 @@ namespace Ryujinx.Graphics.Gpu.Image
int sliceStart = Math.Clamp(offset, 0, subRangeSize);
int sliceEnd = Math.Clamp(endOffset, 0, subRangeSize);
- if (sliceStart != sliceEnd)
+ if (sliceStart != sliceEnd && item.Address != MemoryManager.PteUnmapped)
{
result.Add(GenerateHandle(item.Address + (ulong)sliceStart, (ulong)(sliceEnd - sliceStart)));
}
@@ -1097,11 +1097,20 @@ namespace Ryujinx.Graphics.Gpu.Image
{
// Single dirty region.
var cpuRegionHandles = new CpuRegionHandle[TextureRange.Count];
+ int count = 0;
for (int i = 0; i < TextureRange.Count; i++)
{
var currentRange = TextureRange.GetSubRange(i);
- cpuRegionHandles[i] = GenerateHandle(currentRange.Address, currentRange.Size);
+ if (currentRange.Address != MemoryManager.PteUnmapped)
+ {
+ cpuRegionHandles[count++] = GenerateHandle(currentRange.Address, currentRange.Size);
+ }
+ }
+
+ if (count != TextureRange.Count)
+ {
+ Array.Resize(ref cpuRegionHandles, count);
}
var groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles);
@@ -1277,7 +1286,7 @@ namespace Ryujinx.Graphics.Gpu.Image
TextureInfo info = Storage.Info;
TextureInfo otherInfo = other.Storage.Info;
- if (TextureCompatibility.ViewLayoutCompatible(info, otherInfo, level, otherLevel) &&
+ if (TextureCompatibility.ViewLayoutCompatible(info, otherInfo, level, otherLevel) &&
TextureCompatibility.CopySizeMatches(info, otherInfo, level, otherLevel))
{
// These textures are copy compatible. Create the dependency.