From 9493cdfe553d77d8f37927ef2acf87cfbab1c467 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Fri, 20 Nov 2020 20:14:45 +0000 Subject: Allow copy destination to have a different scale from source (#1711) * Allow copy destination to have a different scale from source Will result in more scaled copy destinations, but allows scaling in some games that copy textures to the output framebuffer. * Support copying multiple levels/layers Uses glFramebufferTextureLayer to copy multiple layers, copies levels individually (and scales the regions). Remove CopyArrayScaled, since the backend copy handles it now. --- Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 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 430b733e..173f5fe4 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MethodCopyTexture.cs @@ -71,12 +71,8 @@ namespace Ryujinx.Graphics.Gpu.Engine return; } - if (srcTexture.ScaleFactor != dstTexture.ScaleFactor) - { - srcTexture.PropagateScale(dstTexture); - } - - float scale = srcTexture.ScaleFactor; // src and dest scales are identical now. + float scale = srcTexture.ScaleFactor; + float dstScale = dstTexture.ScaleFactor; Extents2D srcRegion = new Extents2D( (int)Math.Ceiling(scale * (srcX1 / srcTexture.Info.SamplesInX)), @@ -85,10 +81,10 @@ namespace Ryujinx.Graphics.Gpu.Engine (int)Math.Ceiling(scale * (srcY2 / srcTexture.Info.SamplesInY))); Extents2D dstRegion = new Extents2D( - (int)Math.Ceiling(scale * (dstX1 / dstTexture.Info.SamplesInX)), - (int)Math.Ceiling(scale * (dstY1 / dstTexture.Info.SamplesInY)), - (int)Math.Ceiling(scale * (dstX2 / dstTexture.Info.SamplesInX)), - (int)Math.Ceiling(scale * (dstY2 / dstTexture.Info.SamplesInY))); + (int)Math.Ceiling(dstScale * (dstX1 / dstTexture.Info.SamplesInX)), + (int)Math.Ceiling(dstScale * (dstY1 / dstTexture.Info.SamplesInY)), + (int)Math.Ceiling(dstScale * (dstX2 / dstTexture.Info.SamplesInX)), + (int)Math.Ceiling(dstScale * (dstY2 / dstTexture.Info.SamplesInY))); bool linearFilter = control.UnpackLinearFilter(); @@ -107,10 +103,7 @@ namespace Ryujinx.Graphics.Gpu.Engine srcCopyTexture.Height++; srcTexture = TextureManager.FindOrCreateTexture(srcCopyTexture, srcCopyTextureFormat, srcTexture.ScaleMode == TextureScaleMode.Scaled, srcHint); - if (srcTexture.ScaleFactor != dstTexture.ScaleFactor) - { - srcTexture.PropagateScale(dstTexture); - } + scale = srcTexture.ScaleFactor; srcRegion = new Extents2D( (int)Math.Ceiling(scale * ((srcX1 / srcTexture.Info.SamplesInX) - srcTexture.Info.Width)), -- cgit v1.2.3