0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 12:45:50 +00:00

Fix adjacent 3d texture slices being detected as Incompatible Overlaps (#2993)

This fixes some regressions caused by #2971 which caused rendered 3D texture data to be lost for most slices. Fixes issues with Xenoblade 2's colour grading, probably a ton of other games.

This also removes the check from TextureCache, making it the tiniest bit smaller (any win is a win here).
This commit is contained in:
riperiperi 2022-01-11 08:37:40 +00:00 committed by GitHub
parent 275275f7ac
commit ef24c8983d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -1382,9 +1382,16 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Determine if any of this texture's data overlaps with another. /// Determine if any of this texture's data overlaps with another.
/// </summary> /// </summary>
/// <param name="texture">The texture to check against</param> /// <param name="texture">The texture to check against</param>
/// <param name="compatibility">The view compatibility of the two textures</param>
/// <returns>True if any slice of the textures overlap, false otherwise</returns> /// <returns>True if any slice of the textures overlap, false otherwise</returns>
public bool DataOverlaps(Texture texture) public bool DataOverlaps(Texture texture, TextureViewCompatibility compatibility)
{ {
if (compatibility == TextureViewCompatibility.LayoutIncompatible && Info.GobBlocksInZ > 1 && Info.GobBlocksInZ == texture.Info.GobBlocksInZ)
{
// Allow overlapping slices of layout compatible 3D textures with matching GobBlocksInZ, as they are interleaved.
return false;
}
if (texture._sizeInfo.AllOffsets.Length == 1 && _sizeInfo.AllOffsets.Length == 1) if (texture._sizeInfo.AllOffsets.Length == 1 && _sizeInfo.AllOffsets.Length == 1)
{ {
return Range.OverlapsWith(texture.Range); return Range.OverlapsWith(texture.Range);

View file

@ -582,7 +582,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (oInfo.Compatibility <= TextureViewCompatibility.LayoutIncompatible) if (oInfo.Compatibility <= TextureViewCompatibility.LayoutIncompatible)
{ {
if (!overlap.IsView && texture.DataOverlaps(overlap)) if (!overlap.IsView && texture.DataOverlaps(overlap, oInfo.Compatibility))
{ {
texture.Group.RegisterIncompatibleOverlap(new TextureIncompatibleOverlap(overlap.Group, oInfo.Compatibility), true); texture.Group.RegisterIncompatibleOverlap(new TextureIncompatibleOverlap(overlap.Group, oInfo.Compatibility), true);
} }
@ -657,7 +657,7 @@ namespace Ryujinx.Graphics.Gpu.Image
} }
else else
{ {
bool dataOverlaps = texture.DataOverlaps(overlap); bool dataOverlaps = texture.DataOverlaps(overlap, compatibility);
if (!overlap.IsView && dataOverlaps && !incompatibleOverlaps.Exists(incompatible => incompatible.Group == overlap.Group)) if (!overlap.IsView && dataOverlaps && !incompatibleOverlaps.Exists(incompatible => incompatible.Group == overlap.Group))
{ {
@ -676,12 +676,6 @@ namespace Ryujinx.Graphics.Gpu.Image
continue; continue;
} }
if (info.GobBlocksInZ > 1 && info.GobBlocksInZ == overlap.Info.GobBlocksInZ)
{
// Allow overlapping slices of 3D textures. Could be improved in future by making sure the textures don't overlap.
continue;
}
// The overlap texture is going to contain garbage data after we draw, or is generally incompatible. // The overlap texture is going to contain garbage data after we draw, or is generally incompatible.
// The texture group will obtain copy dependencies for any subresources that are compatible between the two textures, // The texture group will obtain copy dependencies for any subresources that are compatible between the two textures,
// but sometimes its data must be flushed regardless. // but sometimes its data must be flushed regardless.