diff options
author | riperiperi <rhy3756547@hotmail.com> | 2021-08-29 20:22:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-29 16:22:13 -0300 |
commit | 15e7fe3ac940a1768a25326e66683ad0f23127e0 (patch) | |
tree | e596124483034a1b6ab24823745d8c9700d11f57 /Ryujinx.Graphics.Gpu/Image/TextureCache.cs | |
parent | 54adc5f9fb65f4b03bc28da5899d2413a84f66c2 (diff) |
Avoid deleting textures when their data does not overlap. (#2601)
* Avoid deleting textures when their data does not overlap.
It's possible that while two textures start and end addresses indicate an overlap, that the actual data contained within them is sparse due to a layer stride. One such possibility is array slices of a cubemap at different mip levels - they overlap on a whole, but the actual texture data fills the gaps between each other's layers rather than actually overlapping.
This fixes issues with UE4 games having incorrect lighting (solid white screen or really dark shadows). There are still remaining issues with games that use the 3D texture prebaked lighting, such as THPS1+2.
This PR also fixes a bug with TexturePool's resized texture handling where the base level in the descriptor was not considered.
* AllRegions granularity for 3d textures is now by level rather than by slice.
* Address feedback
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureCache.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 37682b65..44c974e8 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -636,6 +636,13 @@ namespace Ryujinx.Graphics.Gpu.Image continue; } + if (!texture.DataOverlaps(overlap)) + { + // Allow textures to overlap if their data does not actually overlap. + // This typically happens when mip level subranges of a layered texture are used. (each texture fills the gaps of the others) + continue; + } + // The overlap texture is going to contain garbage data after we draw, or is generally incompatible. // If the texture cannot be entirely contained in the new address space, and one of its view children is compatible with us, // it must be flushed before removal, so that the data is not lost. |