summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-06-08 16:24:03 -0500
committerDave Parks <davep@lindenlab.com>2022-06-08 16:24:03 -0500
commitda069765b1974e60df5ebf9e973c7fd00c52e329 (patch)
tree418289fee4ccc0f539b3f09026166d08e1a829cf /indra
parentb879c6f3f19c4f2b6791eae67194dcc5f0a020cb (diff)
SL-17005 Tweak target VRAM usage and add some log spam to help zero in on good targets.
Diffstat (limited to 'indra')
-rw-r--r--indra/llwindow/llwindowwin32.cpp22
-rw-r--r--indra/newview/llviewertexture.cpp16
2 files changed, 24 insertions, 14 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index da79660239..20443988ab 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -65,7 +65,6 @@
#include <d3d9.h>
#include <dxgi1_4.h>
-
// Require DirectInput version 8
#define DIRECTINPUT_VERSION 0x0800
@@ -4649,23 +4648,34 @@ void LLWindowWin32::LLWindowWin32Thread::updateVRAMUsage()
mDXGIAdapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info);
// try to use no more than the available reserve minus 10%
- U32 target = info.AvailableForReservation / 1024 / 1024;
- target -= target / 10;
+ U32 target = info.Budget / 1024 / 1024;
+
+ // EXPERIMENTAL
+ // Trying to zero in on a good target usage, code here should be tuned against observed behavior
+ // of various hardware.
+ if (target > 4096) // if 4GB are installed, try to leave 2GB free
+ {
+ target -= 2048;
+ }
+ else // if less than 4GB are installed, try not to use more than half of it
+ {
+ target /= 2;
+ }
U32 used_vram = info.CurrentUsage / 1024 / 1024;
mAvailableVRAM = used_vram < target ? target - used_vram : 0;
- /*LL_INFOS() << "\nLocal\nAFR: " << info.AvailableForReservation / 1024 / 1024
+ LL_INFOS("Window") << "\nLocal\nAFR: " << info.AvailableForReservation / 1024 / 1024
<< "\nBudget: " << info.Budget / 1024 / 1024
<< "\nCR: " << info.CurrentReservation / 1024 / 1024
<< "\nCU: " << info.CurrentUsage / 1024 / 1024 << LL_ENDL;
mDXGIAdapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &info);
- LL_INFOS() << "\nNon-Local\nAFR: " << info.AvailableForReservation / 1024 / 1024
+ LL_INFOS("Window") << "\nNon-Local\nAFR: " << info.AvailableForReservation / 1024 / 1024
<< "\nBudget: " << info.Budget / 1024 / 1024
<< "\nCR: " << info.CurrentReservation / 1024 / 1024
- << "\nCU: " << info.CurrentUsage / 1024 / 1024 << LL_ENDL;*/
+ << "\nCU: " << info.CurrentUsage / 1024 / 1024 << LL_ENDL;
}
else if (mD3DDevice != NULL)
{ // fallback to D3D9
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 16b07159ba..e31bc5ec6e 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -803,14 +803,8 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co
}
virtual_size *= sTexelPixelRatio;
- /*if (!mMaxVirtualSizeResetCounter)
- {
- //flag to reset the values because the old values are used.
- resetMaxVirtualSizeResetCounter();
- mMaxVirtualSize = virtual_size;
- mNeedsGLTexture = needs_gltexture;
- }
- else*/ if (virtual_size > mMaxVirtualSize)
+
+ if (virtual_size > mMaxVirtualSize)
{
mMaxVirtualSize = virtual_size;
}
@@ -1801,6 +1795,12 @@ void LLViewerFetchedTexture::updateVirtualSize()
return;
}
+ if (sDesiredDiscardBias > 0.f)
+ {
+ // running out of video memory, don't hold onto high res textures in the background
+ mMaxVirtualSize = 0.f;
+ }
+
for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
{
llassert(mNumFaces[ch] <= mFaceList[ch].size());