aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-05-03 21:20:12 -0300
committerGitHub <noreply@github.com>2023-05-03 21:20:12 -0300
commit4d1579acbf60ff23f14b591db762267f93092d0c (patch)
tree494acfffeaf6901b19c1967129582c4e3efe7a4c /src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
parent6279f5e4305b1dd5844c0a0e3538fcdd72e6bf33 (diff)
Fix some invalid blits involving depth textures (#4723)1.1.748
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
index 4ce53e78..2ac84ab5 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
@@ -300,11 +300,16 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
IsCopyRegionComplete(srcCopyTexture, srcCopyTextureFormat, srcX1, srcY1, srcX2, srcY2) &&
IsCopyRegionComplete(dstCopyTexture, dstCopyTextureFormat, dstX1, dstY1, dstX2, dstY2);
+ // We can only allow aliasing of color formats as depth if the source and destination textures
+ // are the same, as we can't blit between different depth formats.
+ bool srcDepthAlias = srcCopyTexture.Format == dstCopyTexture.Format;
+
var srcTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
srcCopyTexture,
offset,
srcCopyTextureFormat,
+ srcDepthAlias,
!canDirectCopy,
false,
srcHint);
@@ -325,6 +330,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
// 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.
+ // For depth blit, the destination texture format should always match exactly.
if (srcTexture.Format.IsDepthOrStencil())
{
@@ -340,7 +346,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
dstCopyTexture,
0,
dstCopyTextureFormat,
- true,
+ depthAlias: false,
+ shouldCreate: true,
srcTexture.ScaleMode == TextureScaleMode.Scaled,
dstHint);