diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs | 19 |
1 files changed, 15 insertions, 4 deletions
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<CopyTexture>(MethodOffset.CopyDstTexture); var srcCopyTexture = state.Get<CopyTexture>(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); |