From 3139a85a2b8e83aa6babfbc683bd46ca1d75e448 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Fri, 8 Apr 2022 06:26:48 -0300 Subject: Allow copy texture views to have mismatching multisample state (#3152) --- Ryujinx.Graphics.Gpu/Image/Texture.cs | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index e1f00606..cfb7a3b7 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -1136,17 +1136,33 @@ 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, out int firstLayer, out int firstLevel) + public TextureViewCompatibility IsViewCompatible(TextureInfo info, MultiRange range, int layerSize, Capabilities caps, bool allowMs, out int firstLayer, out int firstLevel) { TextureViewCompatibility result = TextureViewCompatibility.Full; result = TextureCompatibility.PropagateViewCompatibility(result, TextureCompatibility.ViewFormatCompatible(Info, info, caps)); if (result != TextureViewCompatibility.Incompatible) { - result = TextureCompatibility.PropagateViewCompatibility(result, TextureCompatibility.ViewTargetCompatible(Info, info)); + bool msTargetCompatible = false; + + if (allowMs) + { + 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; + } + } if (result == TextureViewCompatibility.Full && Info.FormatInfo.Format != info.FormatInfo.Format && !_context.Capabilities.SupportsMismatchingViewFormat) { @@ -1156,11 +1172,6 @@ namespace Ryujinx.Graphics.Gpu.Image result = TextureViewCompatibility.CopyOnly; } - - if (Info.SamplesInX != info.SamplesInX || Info.SamplesInY != info.SamplesInY) - { - result = TextureViewCompatibility.Incompatible; - } } firstLayer = 0; -- cgit v1.2.3