Skip to content

Commit eb48eea

Browse files
committed
#3364 Cap intel adapters' vram to 25% of ram
1 parent 203ef2f commit eb48eea

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

indra/llwindow/llwindowwin32.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "llstring.h"
4545
#include "lldir.h"
4646
#include "llsdutil.h"
47+
#include "llsys.h"
4748
#include "llglslshader.h"
4849
#include "llthreadsafequeue.h"
4950
#include "stringize.h"
@@ -4681,6 +4682,23 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem()
46814682

46824683
// Alternatively use GetDesc from below to get adapter's memory
46834684
UINT64 budget_mb = info.Budget / (1024 * 1024);
4685+
if (gGLManager.mIsIntel)
4686+
{
4687+
U32Megabytes phys_mb = gSysMemory.getPhysicalMemoryKB();
4688+
LL_WARNS() << "Physical memory: " << phys_mb << " MB" << LL_ENDL;
4689+
4690+
if (phys_mb > 0)
4691+
{
4692+
// Intel uses 'shared' vram, cap it to 25% of total memory
4693+
// Todo: consider caping all adapters at least to 50% ram
4694+
budget_mb = llmin(budget_mb, (UINT64)(phys_mb * 0.25));
4695+
}
4696+
else
4697+
{
4698+
// if no data available, cap to 2Gb
4699+
budget_mb = llmin(budget_mb, (UINT64)2048);
4700+
}
4701+
}
46844702
if (gGLManager.mVRAM < (S32)budget_mb)
46854703
{
46864704
gGLManager.mVRAM = (S32)budget_mb;

0 commit comments

Comments
 (0)