From a3e7bb8eb40b66e61a5a3bfef0b780d0c76a31c1 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 5 Jun 2022 14:06:47 -0300 Subject: Copy dependency for multisample and non-multisample textures (#3382) * Use copy dependency for textures that differs in multisample but are otherwise compatible * Remove allowMs flag as it's no longer required for correctness, it's just an optimization now * Dispose intermmediate pool --- Ryujinx.Graphics.Gpu/Image/Texture.cs | 20 +++++--------------- Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 2 -- Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs | 6 +++++- 3 files changed, 10 insertions(+), 18 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image') diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index cfb7a3b7..aadb4260 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -1136,32 +1136,22 @@ namespace Ryujinx.Graphics.Gpu.Image /// Texture view physical memory ranges /// Layer size on the given texture /// Host GPU capabilities - /// Indicates that multisample textures are allowed to match non-multisample requested textures /// Texture view initial layer on this texture /// Texture view first mipmap level on this texture /// The level of compatiblilty a view with the given parameters created from this texture has - public TextureViewCompatibility IsViewCompatible(TextureInfo info, MultiRange range, int layerSize, Capabilities caps, bool allowMs, out int firstLayer, out int firstLevel) + public TextureViewCompatibility IsViewCompatible(TextureInfo info, MultiRange range, int layerSize, Capabilities caps, out int firstLayer, out int firstLevel) { TextureViewCompatibility result = TextureViewCompatibility.Full; result = TextureCompatibility.PropagateViewCompatibility(result, TextureCompatibility.ViewFormatCompatible(Info, info, caps)); if (result != TextureViewCompatibility.Incompatible) { - bool msTargetCompatible = false; + result = TextureCompatibility.PropagateViewCompatibility(result, TextureCompatibility.ViewTargetCompatible(Info, info)); - if (allowMs) + bool bothMs = Info.Target.IsMultisample() && info.Target.IsMultisample(); + if (bothMs && (Info.SamplesInX != info.SamplesInX || Info.SamplesInY != info.SamplesInY)) { - msTargetCompatible = Info.Target == Target.Texture2DMultisample && info.Target == Target.Texture2D; - } - - if (!msTargetCompatible) - { - result = TextureCompatibility.PropagateViewCompatibility(result, TextureCompatibility.ViewTargetCompatible(Info, info)); - - if (Info.SamplesInX != info.SamplesInX || Info.SamplesInY != info.SamplesInY) - { - result = TextureViewCompatibility.Incompatible; - } + result = TextureViewCompatibility.Incompatible; } if (result == TextureViewCompatibility.Full && Info.FormatInfo.Format != info.FormatInfo.Format && !_context.Capabilities.SupportsMismatchingViewFormat) diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 4fa80c95..04541057 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -547,7 +547,6 @@ namespace Ryujinx.Graphics.Gpu.Image range.Value, sizeInfo.LayerSize, _context.Capabilities, - flags.HasFlag(TextureSearchFlags.ForCopy), out int firstLayer, out int firstLevel); @@ -662,7 +661,6 @@ namespace Ryujinx.Graphics.Gpu.Image overlap.Range, overlap.LayerSize, _context.Capabilities, - false, out int firstLayer, out int firstLevel); diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs index b798441f..61b48dc4 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs @@ -2,7 +2,6 @@ using Ryujinx.Common; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Texture; using System; -using System.Numerics; namespace Ryujinx.Graphics.Gpu.Image { @@ -657,6 +656,11 @@ namespace Ryujinx.Graphics.Gpu.Image case Target.Texture2DMultisample: case Target.Texture2DMultisampleArray: + if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray) + { + return TextureViewCompatibility.CopyOnly; + } + result = rhs.Target == Target.Texture2DMultisample || rhs.Target == Target.Texture2DMultisampleArray; break; -- cgit v1.2.3