Skip to content

Commit

Permalink
GS/HW: Don't try to draw with invalid TEX0 configuration
Browse files Browse the repository at this point in the history
Fixes the texture cache falling apart in 007: Everything or Nothing.
  • Loading branch information
stenzek authored and refractionpcsx2 committed Feb 26, 2023
1 parent 980e2f6 commit e85790b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pcsx2/GS/Renderers/HW/GSTextureCache.cpp
Expand Up @@ -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;

Expand Down

0 comments on commit e85790b

Please sign in to comment.