Skip to content

Commit cfbfe0d

Browse files
authored
bugfix(textureloader): Lift hardcoded texture aspect ratio limit of 1:8 to allow loading all textures with modern gpu (#2788)
1 parent f06f183 commit cfbfe0d

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

Core/Libraries/Source/WWVegas/WW3D2/textureloader.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void TextureLoader::Validate_Texture_Size
373373
}
374374

375375
unsigned poweroftwodepth = 1;
376-
while (poweroftwodepth< depth)
376+
while (poweroftwodepth < depth)
377377
{
378378
poweroftwodepth <<= 1;
379379
}
@@ -391,18 +391,22 @@ void TextureLoader::Validate_Texture_Size
391391
poweroftwodepth=dx8caps.MaxVolumeExtent;
392392
}
393393

394-
if (poweroftwowidth>poweroftwoheight)
394+
const unsigned maxTextureAspectRatio = dx8caps.MaxTextureAspectRatio;
395+
if (maxTextureAspectRatio != 0)
395396
{
396-
while (poweroftwowidth/poweroftwoheight>8)
397+
if (poweroftwowidth>poweroftwoheight)
397398
{
398-
poweroftwoheight*=2;
399+
while (poweroftwowidth/poweroftwoheight > maxTextureAspectRatio)
400+
{
401+
poweroftwoheight*=2;
402+
}
399403
}
400-
}
401-
else
402-
{
403-
while (poweroftwoheight/poweroftwowidth>8)
404+
else
404405
{
405-
poweroftwowidth*=2;
406+
while (poweroftwoheight/poweroftwowidth > maxTextureAspectRatio)
407+
{
408+
poweroftwowidth*=2;
409+
}
406410
}
407411
}
408412

0 commit comments

Comments
 (0)