Skip to content

Commit aadbe9d

Browse files
committed
bugfix(gamelod): Disable the recommended static lod level for texture reduction to prevent low texture resolution with Medium and High specs
1 parent 739a73c commit aadbe9d

File tree

2 files changed

+41
-13
lines changed

2 files changed

+41
-13
lines changed

GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class GameLODManager
204204
void applyStaticLODLevel(StaticGameLODLevel level);
205205
void applyDynamicLODLevel(DynamicGameLODLevel level);
206206
void refreshCustomStaticLODLevel(void); ///<grabs current globaldata values and makes them the custom detail setting.
207+
StaticGameLODLevel getRecommendedTextureLODLevel();
207208

208209
static const FieldParse m_staticGameLODFieldParseTable[];
209210
StaticGameLODLevel m_currentStaticLOD; ///< current value of static LOD.

GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,23 @@ void GameLODManager::applyStaticLODLevel(StaticGameLODLevel level)
560560
StaticGameLODInfo *lodInfo=&m_staticGameLODInfo[level];
561561
StaticGameLODInfo *prevLodInfo=&prevLodBackup;
562562

563-
Int requestedTextureReduction = 0;
564-
Bool requestedTrees = m_memPassed; //only use trees if memory requirement passed.
563+
Int requestedTextureReduction;
564+
Bool requestedTrees;
565565
if (level == STATIC_GAME_LOD_CUSTOM)
566-
{ requestedTextureReduction = lodInfo->m_textureReduction;
566+
{
567+
requestedTextureReduction = lodInfo->m_textureReduction;
567568
requestedTrees = lodInfo->m_useTrees;
568569
}
569570
else
570-
if (level >= STATIC_GAME_LOD_LOW)
571-
{ //normal non-custom level gets texture reduction based on recommendation
572-
requestedTextureReduction = getRecommendedTextureReduction();
571+
{
572+
//normal non-custom level gets texture reduction based on recommendation
573+
StaticGameLODLevel textureLevel = getRecommendedTextureLODLevel();
574+
if (textureLevel == STATIC_GAME_LOD_UNKNOWN)
575+
textureLevel = level;
576+
requestedTextureReduction = getLevelTextureReduction(textureLevel);
577+
578+
//only use trees if memory requirement passed.
579+
requestedTrees = m_memPassed;
573580
}
574581

575582
if (TheGlobalData)
@@ -723,16 +730,36 @@ void GameLODManager::applyDynamicLODLevel(DynamicGameLODLevel level)
723730

724731
Int GameLODManager::getRecommendedTextureReduction(void)
725732
{
726-
if (m_idealDetailLevel == STATIC_GAME_LOD_UNKNOWN)
727-
getRecommendedStaticLODLevel(); //it was never tested, so test now.
733+
StaticGameLODLevel level = getRecommendedTextureLODLevel();
734+
735+
if (level == STATIC_GAME_LOD_UNKNOWN)
736+
{
737+
level = getStaticLODLevel();
738+
}
739+
return getLevelTextureReduction(level);
740+
}
728741

729-
if (!m_memPassed) //if they have < 256 MB, force them to low res textures.
730-
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);
742+
StaticGameLODLevel GameLODManager::getRecommendedTextureLODLevel()
743+
{
744+
// TheSuperHackers @bugfix xezon 24/09/2025 Disables the recommended static LOD level for texture reduction
745+
// because the benchmark code always generates a low level for it. Can revisit if the benchmarking is changed.
746+
constexpr const Bool UseRecommendedStaticLODLevel = FALSE;
731747

732-
if (m_idealDetailLevel < 0 || m_idealDetailLevel >= STATIC_GAME_LOD_COUNT)
733-
return getLevelTextureReduction(STATIC_GAME_LOD_LOW);
748+
StaticGameLODLevel level = STATIC_GAME_LOD_LOW;
734749

735-
return getLevelTextureReduction(m_idealDetailLevel);
750+
// Force low res textures if user has less than 256 MB.
751+
if (m_memPassed)
752+
{
753+
if constexpr (UseRecommendedStaticLODLevel)
754+
{
755+
level = getRecommendedStaticLODLevel();
756+
}
757+
else
758+
{
759+
level = STATIC_GAME_LOD_UNKNOWN;
760+
}
761+
}
762+
return level;
736763
}
737764

738765
Int GameLODManager::getLevelTextureReduction(StaticGameLODLevel level)

0 commit comments

Comments
 (0)