Separate zeta from color formats (#1647)

This commit is contained in:
gdkchan 2020-11-05 19:50:34 -03:00 committed by GitHub
parent 64088f04e3
commit a89b81a812
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 197 additions and 201 deletions

View file

@ -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;
Texture dstTexture = TextureManager.FindOrCreateTexture(dstCopyTexture, srcTexture.ScaleMode == Image.TextureScaleMode.Scaled);
if (srcTexture.Format.IsDepthOrStencil())
{
dstCopyTextureFormat = srcCopyTextureFormat;
}
else
{
dstCopyTextureFormat = dstCopyTexture.Format.Convert();
}
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);