Skip to content
Snippets Groups Projects
Commit da2caa46 authored by Graham Madarasz (Graham Linden)'s avatar Graham Madarasz (Graham Linden)
Browse files

For MAINT-2003 and MAINT-1555 Fixes sequencing issue in determining max vram...

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
parent eb859ce5
No related branches found
No related tags found
No related merge requests found
...@@ -89,8 +89,10 @@ void LLFloaterHardwareSettings::refresh() ...@@ -89,8 +89,10 @@ void LLFloaterHardwareSettings::refresh()
void LLFloaterHardwareSettings::refreshEnabledState() void LLFloaterHardwareSettings::refreshEnabledState()
{ {
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); 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")->setMinValue(min_tex_mem);
getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem); getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem);
......
...@@ -1191,7 +1191,7 @@ S32 LLViewerTextureList::getMinVideoRamSetting() ...@@ -1191,7 +1191,7 @@ S32 LLViewerTextureList::getMinVideoRamSetting()
//static //static
// Returns max setting for TextureMemory (in MB) // 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; S32 max_texmem;
if (gGLManager.mVRAM != 0) if (gGLManager.mVRAM != 0)
...@@ -1235,7 +1235,10 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended) ...@@ -1235,7 +1235,10 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended)
max_texmem = llmin(max_texmem, (S32)(system_ram/2)); max_texmem = llmin(max_texmem, (S32)(system_ram/2));
else else
max_texmem = llmin(max_texmem, (S32)(system_ram)); 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); max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES);
return max_texmem; return max_texmem;
...@@ -1248,7 +1251,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) ...@@ -1248,7 +1251,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
// Initialize the image pipeline VRAM settings // Initialize the image pipeline VRAM settings
S32 cur_mem = gSavedSettings.getS32("TextureMemory"); S32 cur_mem = gSavedSettings.getS32("TextureMemory");
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); 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) if (mem == 0)
{ {
mem = cur_mem > 0 ? cur_mem : default_mem; mem = cur_mem > 0 ? cur_mem : default_mem;
...@@ -1258,10 +1261,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) ...@@ -1258,10 +1261,7 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
mem = default_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 = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting(false, mem_multiplier));
mem = llmin(mem, (S32) (mem_multiplier * (F32) default_mem));
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting());
if (mem != cur_mem) if (mem != cur_mem)
{ {
gSavedSettings.setS32("TextureMemory", mem); gSavedSettings.setS32("TextureMemory", mem);
......
...@@ -114,7 +114,7 @@ class LLViewerTextureList ...@@ -114,7 +114,7 @@ class LLViewerTextureList
void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level); void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level);
static S32 getMinVideoRamSetting(); static S32 getMinVideoRamSetting();
static S32 getMaxVideoRamSetting(bool get_recommended = false); static S32 getMaxVideoRamSetting(bool get_recommended, float mem_multiplier);
private: private:
void updateImagesDecodePriorities(); void updateImagesDecodePriorities();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment