For MAINT-2003 and MAINT-1555 Fixes sequencing issue in determining max vram where mem multiplier was being done after already clamping to 512M, robbing people with >512M of 256M. Code review: DaveP

meow-7.2.2
Graham Madarasz (Graham Linden) 2013-02-27 13:10:41 -08:00
parent eb859ce5c1
commit da2caa4640
3 changed files with 11 additions and 9 deletions

View File

@ -89,8 +89,10 @@ void LLFloaterHardwareSettings::refresh()
void LLFloaterHardwareSettings::refreshEnabledState()
{
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting();
S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier);
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem);
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem);

View File

@ -1191,7 +1191,7 @@ S32 LLViewerTextureList::getMinVideoRamSetting()
//static
// Returns max setting for TextureMemory (in MB)
S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, float mem_multiplier)
{
S32 max_texmem;
if (gGLManager.mVRAM != 0)
@ -1235,7 +1235,10 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
max_texmem = llmin(max_texmem, (S32)(system_ram/2));
else
max_texmem = llmin(max_texmem, (S32)(system_ram));
// limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise
max_texmem = llmin(max_texmem, (S32) (mem_multiplier * (F32) max_texmem));
max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES);
return max_texmem;
@ -1248,7 +1251,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
// Initialize the image pipeline VRAM settings
S32 cur_mem = gSavedSettings.getS32("TextureMemory");
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32 default_mem = getMaxVideoRamSetting(true); // recommended default
S32 default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default
if (mem == 0)
{
mem = cur_mem > 0 ? cur_mem : default_mem;
@ -1258,10 +1261,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
mem = default_mem;
}
// limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise
mem = llmin(mem, (S32) (mem_multiplier * (F32) default_mem));
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting());
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting(false, mem_multiplier));
if (mem != cur_mem)
{
gSavedSettings.setS32("TextureMemory", mem);

View File

@ -114,7 +114,7 @@ public:
void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);
static S32 getMinVideoRamSetting();
static S32 getMaxVideoRamSetting(bool get_recommended = false);
static S32 getMaxVideoRamSetting(bool get_recommended, float mem_multiplier);
private:
void updateImagesDecodePriorities();