diff options
author | Howard Stearns <howard.stearns@gmail.com> | 2022-06-13 14:03:04 -0700 |
---|---|---|
committer | Howard Stearns <howard.stearns@gmail.com> | 2022-06-13 14:03:04 -0700 |
commit | 9d9c2037e10966bdf4b07ef3fed081c04a4ed30a (patch) | |
tree | 2650993a565233f5995e6abe44f14d48d48619ac /indra/llwindow | |
parent | 91a9665e35a3bfeb5a2bc81586a23e70bb2c7596 (diff) | |
parent | c9a48a1cdd23a592eb25454d5e2d6c316ec93445 (diff) |
Merge branch 'DRTVWR-564' of bitbucket.org:lindenlab/viewer into SL-17485
Diffstat (limited to 'indra/llwindow')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 22 |
1 files changed, 16 insertions, 6 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 |