Disallow patches >2048 in size

Our technical hardware support baseline is GLES2, which has a minimum
supported texture size of 2048x2048. This means we cannot allow anything
larger without introducing compatibility issues between GL players and
software players. Even if Software is able to handle larger images,
GL hardware may not, even on the same device. This additionally prevents
an issue with Twodee where the patch atlas can't handle images larger
than 2048x2048 due to the page size.
This commit is contained in:
Eidolon 2024-03-09 14:39:35 -06:00
parent 748ef17cf7
commit 875d32800f

View file

@ -1931,6 +1931,17 @@ static void *MakePatch(void *lumpdata, size_t size, INT32 tag, void *cache)
Patch_Create(static_cast<softwarepatch_t*>(ptr), len, dest);
{
patch_t* patch = (patch_t*) ptr;
if (patch->width > 2048 || patch->height > 2048)
{
// This is INTENTIONAL. Even if software can handle it, very old GL hardware will not.
// For the sake of a compatibility baseline, we will not allow anything larger than this.
I_Error("Patch size cannot be greater than 2048x2048!");
}
}
return dest;
}