fix for non pow2 width textures in software from doom-legacy

This commit is contained in:
Alug committed 2025-07-08 16:52:56 +01:00
1 parent 9f678263d0
commit 14be968089
1 file changed
+14
+14
View File
@@ -595,9 +595,23 @@ Rloadtextures (INT32 i, INT32 w)
Z_Free(patchlump);
// determine width power of 2
#if 1
// [WDJ] only need to determine if exact power of 2.
k = 1;
while (k < texture->width)
k<<=1;
#else
// Largest power of 2 that fits within width.
k = 1;
while (k << 1 <= texture->width)
k <<= 1;
#endif
if (k != texture->width)
{
// Odd width
k = 1; // make texturewidthmask = 0
}
texturewidthmask[i] = k - 1;
textureheight[i] = texture->height << FRACBITS;