diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-04-08 06:26:48 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 11:26:48 +0200 |
commit | 3139a85a2b8e83aa6babfbc683bd46ca1d75e448 (patch) | |
tree | 47d63d2d0e5d6d00067f419c266bbac4e397b93d /Ryujinx.Graphics.Gpu/Image/TextureCache.cs | |
parent | a4e8bea86600a230d57d2b94e5b8ad61aefa593c (diff) |
Allow copy texture views to have mismatching multisample state (#3152)1.1.98
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureCache.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 16248308..4fa80c95 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -542,7 +542,14 @@ namespace Ryujinx.Graphics.Gpu.Image for (int index = 0; index < overlapsCount; index++) { Texture overlap = _textureOverlaps[index]; - TextureViewCompatibility overlapCompatibility = overlap.IsViewCompatible(info, range.Value, sizeInfo.LayerSize, _context.Capabilities, out int firstLayer, out int firstLevel); + TextureViewCompatibility overlapCompatibility = overlap.IsViewCompatible( + info, + range.Value, + sizeInfo.LayerSize, + _context.Capabilities, + flags.HasFlag(TextureSearchFlags.ForCopy), + out int firstLayer, + out int firstLevel); if (overlapCompatibility == TextureViewCompatibility.Full) { @@ -650,7 +657,14 @@ namespace Ryujinx.Graphics.Gpu.Image Texture overlap = _textureOverlaps[index]; bool overlapInCache = overlap.CacheNode != null; - TextureViewCompatibility compatibility = texture.IsViewCompatible(overlap.Info, overlap.Range, overlap.LayerSize, _context.Capabilities, out int firstLayer, out int firstLevel); + TextureViewCompatibility compatibility = texture.IsViewCompatible( + overlap.Info, + overlap.Range, + overlap.LayerSize, + _context.Capabilities, + false, + out int firstLayer, + out int firstLevel); if (overlap.IsView && compatibility == TextureViewCompatibility.Full) { @@ -1000,20 +1014,34 @@ namespace Ryujinx.Graphics.Gpu.Image depthOrLayers = info.DepthOrLayers; } + // 2D and 2D multisample textures are not considered compatible. + // This specific case is required for copies, where the source texture might be multisample. + // In this case, we inherit the parent texture multisample state. + Target target = info.Target; + int samplesInX = info.SamplesInX; + int samplesInY = info.SamplesInY; + + if (target == Target.Texture2D && parent.Target == Target.Texture2DMultisample) + { + target = Target.Texture2DMultisample; + samplesInX = parent.Info.SamplesInX; + samplesInY = parent.Info.SamplesInY; + } + return new TextureInfo( info.GpuAddress, width, height, depthOrLayers, info.Levels, - info.SamplesInX, - info.SamplesInY, + samplesInX, + samplesInY, info.Stride, info.IsLinear, info.GobBlocksInY, info.GobBlocksInZ, info.GobBlocksInTileX, - info.Target, + target, info.FormatInfo, info.DepthStencilMode, info.SwizzleR, |