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.
This commit is contained in:
riperiperi 2020-11-20 20:14:45 +00:00 committed by GitHub
parent cf7044e37b
commit 9493cdfe55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 98 deletions

View file

@ -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)),