aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs44
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureManager.cs5
2 files changed, 3 insertions, 46 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
index b07aeaf1..6b85e49a 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureCompatibility.cs
@@ -1,6 +1,5 @@
using Ryujinx.Common;
using Ryujinx.Graphics.GAL;
-using Ryujinx.Graphics.Gpu.State;
using Ryujinx.Graphics.Texture;
using System;
@@ -89,26 +88,6 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
- /// Finds the appropriate depth format for a copy texture if the source texture has a depth format.
- /// </summary>
- /// <param name="dstTextureFormat">Destination CopyTexture Format</param>
- /// <param name="srcTextureFormat">Source Texture Format</param>
- /// <returns>Derived RtFormat if srcTextureFormat is a depth format, otherwise return dstTextureFormat.</returns>
- public static RtFormat DeriveDepthFormat(RtFormat dstTextureFormat, Format srcTextureFormat)
- {
- return srcTextureFormat switch
- {
- Format.S8Uint => RtFormat.S8Uint,
- Format.D16Unorm => RtFormat.D16Unorm,
- Format.D24X8Unorm => RtFormat.D24Unorm,
- Format.D32Float => RtFormat.D32Float,
- Format.D24UnormS8Uint => RtFormat.D24UnormS8Uint,
- Format.D32FloatS8Uint => RtFormat.D32FloatS8Uint,
- _ => dstTextureFormat
- };
- }
-
- /// <summary>
/// Checks if two formats are compatible, according to the host API copy format compatibility rules.
/// </summary>
/// <param name="lhs">First comparand</param>
@@ -116,7 +95,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <returns>True if the formats are compatible, false otherwise</returns>
public static bool FormatCompatible(FormatInfo lhs, FormatInfo rhs)
{
- if (IsDsFormat(lhs.Format) || IsDsFormat(rhs.Format))
+ if (lhs.Format.IsDepthOrStencil() || rhs.Format.IsDepthOrStencil())
{
return lhs.Format == rhs.Format;
}
@@ -567,26 +546,5 @@ namespace Ryujinx.Graphics.Gpu.Image
return FormatClass.Unclassified;
}
-
- /// <summary>
- /// Checks if the format is a depth-stencil texture format.
- /// </summary>
- /// <param name="format">Format to check</param>
- /// <returns>True if the format is a depth-stencil format (including depth only), false otherwise</returns>
- private static bool IsDsFormat(Format format)
- {
- switch (format)
- {
- case Format.D16Unorm:
- case Format.D24X8Unorm:
- case Format.D24UnormS8Uint:
- case Format.D32Float:
- case Format.D32FloatS8Uint:
- case Format.S8Uint:
- return true;
- }
-
- return false;
- }
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index 08398cb6..0694f3e3 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -451,9 +451,10 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Tries to find an existing texture, or create a new one if not found.
/// </summary>
/// <param name="copyTexture">Copy texture to find or create</param>
+ /// <param name="formatInfo">Format information of the copy texture</param>
/// <param name="preferScaling">Indicates if the texture should be scaled from the start</param>
/// <returns>The texture</returns>
- public Texture FindOrCreateTexture(CopyTexture copyTexture, bool preferScaling = true)
+ public Texture FindOrCreateTexture(CopyTexture copyTexture, FormatInfo formatInfo, bool preferScaling = true)
{
ulong address = _context.MemoryManager.Translate(copyTexture.Address.Pack());
@@ -465,8 +466,6 @@ namespace Ryujinx.Graphics.Gpu.Image
int gobBlocksInY = copyTexture.MemoryLayout.UnpackGobBlocksInY();
int gobBlocksInZ = copyTexture.MemoryLayout.UnpackGobBlocksInZ();
- FormatInfo formatInfo = copyTexture.Format.Convert();
-
int width;
if (copyTexture.LinearLayout)