Improve some texture limit calculations

master
Ansariel 2016-07-12 19:14:01 +02:00
parent bd683aba8a
commit f2c7d3f60e
5 changed files with 26 additions and 10 deletions

View File

@ -1158,6 +1158,26 @@ bool LLAppViewer::init()
// Early out from user choice.
return false;
}
// <FS:Ansariel> Texture memory management
// On 64bit builds, allow up to 1GB texture memory on cards with 2GB video
// memory and up to 2GB texture memory on cards with 4GB video memory. Check
// is performed against a lower limit as not exactly 2 or 4GB might not be
// returned.
#ifdef ND_BUILD64BIT_ARCH
if (gGLManager.mVRAM > 3584)
{
gMaxVideoRam = S32Megabytes(2048);
LL_INFOS() << "At least 4 GB video memory detected - increasing max video ram to " << gMaxVideoRam.value() << " MB" << LL_ENDL;
}
else if (gGLManager.mVRAM > 1536)
{
gMaxVideoRam = S32Megabytes(1024);
LL_INFOS() << "At least 2 GB video memory detected - increasing max video ram to " << gMaxVideoRam.value() << " MB" << LL_ENDL;
}
#endif
// </FS:Ansariel>
LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ;
// Prepare for out-of-memory situations, during which we will crash on

View File

@ -4024,9 +4024,6 @@ BOOL LLPanelPreferenceGraphics::postBuild()
#endif // LL_DARWIN
// </FS:CR>
// <FS:Ansariel> Texture memory management
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue((F32)gMaxVideoRam.value());
return LLPanelPreference::postBuild();
}
void LLPanelPreferenceGraphics::draw()

View File

@ -68,11 +68,7 @@
const S32Megabytes gMinVideoRam(32);
// <FS:Ansariel> Texture memory management
//const S32Megabytes gMaxVideoRam(512);
#ifdef ND_BUILD64BIT_ARCH
const S32Megabytes gMaxVideoRam(1024);
#else
const S32Megabytes gMaxVideoRam(512);
#endif
S32Megabytes gMaxVideoRam(512);
// </FS:Ansariel>

View File

@ -40,7 +40,10 @@
#include <list>
extern const S32Megabytes gMinVideoRam;
extern const S32Megabytes gMaxVideoRam;
// <FS:Ansariel> Texture memory management
//extern const S32Megabytes gMaxVideoRam;
extern S32Megabytes gMaxVideoRam;
// </FS:Ansariel>
class LLFace;
class LLImageGL ;

View File

@ -1040,7 +1040,7 @@
layout="topleft"
left="10"
min_val="64"
max_val="1024"
max_val="2048"
name="GraphicsCardTextureMemory"
tool_tip="Amount of memory to allocate for textures. Defaults to video card memory up to 512M. Reducing this may improve performance but may also make textures blurry. Increasing this value beyond 512M is not recommended. Even if your graphics cards supports it, the main memory impact on the viewer is likely to lead to a degraded SL experience."
top_pad="10"