aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs41
1 files changed, 37 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
index e3574be5..d613612f 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
@@ -215,7 +215,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="lhs">Texture information of the texture view</param>
/// <param name="rhs">Texture information of the texture view to match against</param>
/// <param name="level">Mipmap level of the texture view in relation to this texture</param>
- /// <returns>True if the sizes are compatible, false otherwise</returns>
+ /// <returns>The view compatibility level of the view sizes</returns>
public static TextureViewCompatibility ViewSizeMatches(TextureInfo lhs, TextureInfo rhs, int level)
{
Size size = GetAlignedSize(lhs, level);
@@ -236,6 +236,27 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
+ /// Checks if the potential child texture fits within the level and layer bounds of the parent.
+ /// </summary>
+ /// <param name="parent">Texture information for the parent</param>
+ /// <param name="child">Texture information for the child</param>
+ /// <param name="layer">Base layer of the child texture</param>
+ /// <param name="level">Base level of the child texture</param>
+ /// <returns>Full compatiblity if the child's layer and level count fit within the parent, incompatible otherwise</returns>
+ public static TextureViewCompatibility ViewSubImagesInBounds(TextureInfo parent, TextureInfo child, int layer, int level)
+ {
+ if (level + child.Levels <= parent.Levels &&
+ layer + child.GetSlices() <= parent.GetSlices())
+ {
+ return TextureViewCompatibility.Full;
+ }
+ else
+ {
+ return TextureViewCompatibility.Incompatible;
+ }
+ }
+
+ /// <summary>
/// Checks if the texture sizes of the supplied texture informations match.
/// </summary>
/// <param name="lhs">Texture information to compare</param>
@@ -382,10 +403,22 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary>
/// <param name="lhs">Texture information of the texture view</param>
/// <param name="rhs">Texture information of the texture view</param>
- /// <returns>True if the formats are compatible, false otherwise</returns>
- public static bool ViewFormatCompatible(TextureInfo lhs, TextureInfo rhs)
+ /// <returns>The view compatibility level of the texture formats</returns>
+ public static TextureViewCompatibility ViewFormatCompatible(TextureInfo lhs, TextureInfo rhs)
{
- return FormatCompatible(lhs.FormatInfo, rhs.FormatInfo);
+ if (FormatCompatible(lhs.FormatInfo, rhs.FormatInfo))
+ {
+ if (lhs.FormatInfo.IsCompressed != rhs.FormatInfo.IsCompressed)
+ {
+ return TextureViewCompatibility.CopyOnly;
+ }
+ else
+ {
+ return TextureViewCompatibility.Full;
+ }
+ }
+
+ return TextureViewCompatibility.Incompatible;
}
/// <summary>