From a89b81a81217016afe0403cfa389afe8181507dc Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 5 Nov 2020 19:50:34 -0300 Subject: Separate zeta from color formats (#1647) --- Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs') diff --git a/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs b/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs index 8e92685b..4856172a 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs @@ -19,7 +19,9 @@ namespace Ryujinx.Graphics.Gpu.Engine var dstCopyTexture = state.Get(MethodOffset.CopyDstTexture); var srcCopyTexture = state.Get(MethodOffset.CopySrcTexture); - Texture srcTexture = TextureManager.FindOrCreateTexture(srcCopyTexture); + var srcCopyTextureFormat = srcCopyTexture.Format.Convert(); + + Texture srcTexture = TextureManager.FindOrCreateTexture(srcCopyTexture, srcCopyTextureFormat); if (srcTexture == null) { @@ -29,9 +31,18 @@ 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. - dstCopyTexture.Format = TextureCompatibility.DeriveDepthFormat(dstCopyTexture.Format, srcTexture.Format); + FormatInfo dstCopyTextureFormat; + + if (srcTexture.Format.IsDepthOrStencil()) + { + dstCopyTextureFormat = srcCopyTextureFormat; + } + else + { + dstCopyTextureFormat = dstCopyTexture.Format.Convert(); + } - Texture dstTexture = TextureManager.FindOrCreateTexture(dstCopyTexture, srcTexture.ScaleMode == Image.TextureScaleMode.Scaled); + Texture dstTexture = TextureManager.FindOrCreateTexture(dstCopyTexture, dstCopyTextureFormat, srcTexture.ScaleMode == TextureScaleMode.Scaled); if (dstTexture == null) { @@ -89,7 +100,7 @@ namespace Ryujinx.Graphics.Gpu.Engine { srcCopyTexture.Height++; - srcTexture = TextureManager.FindOrCreateTexture(srcCopyTexture, srcTexture.ScaleMode == Image.TextureScaleMode.Scaled); + srcTexture = TextureManager.FindOrCreateTexture(srcCopyTexture, srcCopyTextureFormat, srcTexture.ScaleMode == TextureScaleMode.Scaled); if (srcTexture.ScaleFactor != dstTexture.ScaleFactor) { srcTexture.PropagateScale(dstTexture); -- cgit v1.2.3