From 2a314f3c28bb000b796f784a0eb791b63eae22c2 Mon Sep 17 00:00:00 2001 From: mageven <62494521+mageven@users.noreply.github.com> Date: Fri, 14 Aug 2020 15:33:19 +0530 Subject: [PATCH] Add missing depth-color conversions in CopyTexture (#1474) * Add missing depth-color conversions in CopyTexture * Whitespace * switch expression --- Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs b/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs index 07afb253..af7ac038 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs @@ -28,10 +28,16 @@ namespace Ryujinx.Graphics.Gpu.Engine // When the source texture that was found has a depth format, // we must enforce the target texture also has a depth format, // as copies between depth and color formats are not allowed. - if (srcTexture.Format == Format.D32Float) + dstCopyTexture.Format = srcTexture.Format switch { - dstCopyTexture.Format = RtFormat.D32Float; - } + Format.S8Uint => RtFormat.S8Uint, + Format.D16Unorm => RtFormat.D16Unorm, + Format.D24X8Unorm => RtFormat.D24Unorm, + Format.D32Float => RtFormat.D32Float, + Format.D24UnormS8Uint => RtFormat.D24UnormS8Uint, + Format.D32FloatS8Uint => RtFormat.D32FloatS8Uint, + _ => dstCopyTexture.Format + }; Texture dstTexture = TextureManager.FindOrCreateTexture(dstCopyTexture, srcTexture.ScaleMode == Image.TextureScaleMode.Scaled);