From e85790b84bc6f379037eff9c3110e085a5032bf0 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 26 Feb 2023 13:41:34 +1000 Subject: [PATCH] GS/HW: Don't try to draw with invalid TEX0 configuration Fixes the texture cache falling apart in 007: Everything or Nothing. --- pcsx2/GS/Renderers/HW/GSTextureCache.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp index 696fecd9c3..ef019a66f9 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.cpp +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.cpp @@ -330,6 +330,13 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con } } + // Prevent everything going to rubbish if a game somehow sends a TW/TH above 10, and region isn't being used. + if ((TEX0.TW > 10 && !region.HasX()) || (TEX0.TH > 10 && !region.HasY())) + { + GL_CACHE("Invalid TEX0 size %ux%u without region, aborting draw.", TEX0.TW, TEX0.TH); + throw GSRecoverableError(); + } + const GSVector2i compare_lod(lod ? *lod : GSVector2i(0, 0)); Source* src = nullptr;