aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2021-08-11 21:44:51 +0100
committerGitHub <noreply@github.com>2021-08-11 22:44:51 +0200
commit0a80a837cb30402cad1f41293134edbaeeec6451 (patch)
treea743795873cdda800d729630e16989c1ebb01ad3 /Ryujinx.Graphics.Gpu/Image/TextureManager.cs
parented754af8d5046d2fd7218c742521e38ab17cbcfe (diff)
Use "Undesired" scale mode for certain textures rather than blacklisting (#2537)
* Use "Undesired" scale mode for certain textures rather than blacklisting * Nit Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureManager.cs23
1 files changed, 19 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index 157b7c17..4db6532b 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -141,6 +141,16 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
+ /// Check if a texture's scale must be updated to match the configured resolution scale.
+ /// </summary>
+ /// <param name="texture">The texture to check</param>
+ /// <returns>True if the scale needs updating, false if the scale is up to date</returns>
+ private bool ScaleNeedsUpdated(Texture texture)
+ {
+ return texture != null && !(texture.ScaleMode == TextureScaleMode.Blacklisted || texture.ScaleMode == TextureScaleMode.Undesired) && texture.ScaleFactor != GraphicsConfig.ResScale;
+ }
+
+ /// <summary>
/// Sets the render target color buffer.
/// </summary>
/// <param name="index">The index of the color buffer to set (up to 8)</param>
@@ -164,7 +174,7 @@ namespace Ryujinx.Graphics.Gpu.Image
_rtColors[index] = color;
}
- return changesScale || (hasValue && color.ScaleMode != TextureScaleMode.Blacklisted && color.ScaleFactor != GraphicsConfig.ResScale);
+ return changesScale || ScaleNeedsUpdated(color);
}
/// <summary>
@@ -190,7 +200,7 @@ namespace Ryujinx.Graphics.Gpu.Image
_rtDepthStencil = depthStencil;
}
- return changesScale || (hasValue && depthStencil.ScaleMode != TextureScaleMode.Blacklisted && depthStencil.ScaleFactor != GraphicsConfig.ResScale);
+ return changesScale || ScaleNeedsUpdated(depthStencil);
}
/// <summary>
@@ -214,6 +224,7 @@ namespace Ryujinx.Graphics.Gpu.Image
bool mismatch = false;
bool blacklisted = false;
bool hasUpscaled = false;
+ bool hasUndesired = false;
float targetScale = GraphicsConfig.ResScale;
void ConsiderTarget(Texture target)
@@ -230,9 +241,13 @@ namespace Ryujinx.Graphics.Gpu.Image
case TextureScaleMode.Eligible:
mismatch = true; // We must make a decision.
break;
+ case TextureScaleMode.Undesired:
+ hasUndesired = true;
+ mismatch |= scale != 1f || hasUpscaled; // If another target is upscaled, scale this one up too.
+ break;
case TextureScaleMode.Scaled:
hasUpscaled = true;
- mismatch |= scale != targetScale; // If the target scale has changed, reset the scale for all targets.
+ mismatch |= hasUndesired || scale != targetScale; // If the target scale has changed, reset the scale for all targets.
break;
}
}
@@ -254,7 +269,7 @@ namespace Ryujinx.Graphics.Gpu.Image
mismatch |= blacklisted && hasUpscaled;
- if (blacklisted)
+ if (blacklisted || (hasUndesired && !hasUpscaled))
{
targetScale = 1f;
}