From 5811d121dfc10239ce2f14e36b2addb37df3c83c Mon Sep 17 00:00:00 2001
From: riperiperi <rhy3756547@hotmail.com>
Date: Fri, 15 Jul 2022 13:24:13 +0100
Subject: [PATCH] Avoid scaling 2d textures that could be used as 3d (#3464)

---
 Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
index ba863a1e1f..ef29fe96d7 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
@@ -174,6 +174,14 @@ namespace Ryujinx.Graphics.Gpu.Image
                 }
             }
 
+            if (info.Width == info.Height * info.Height)
+            {
+                // Possibly used for a "3D texture" drawn onto a 2D surface.
+                // Some games do this to generate a tone mapping LUT without rendering into 3D texture slices.
+
+                return false;
+            }
+
             return true;
         }