Skip to content

Commit

Permalink
#3364 Cap intel adapters' vram to 25% of ram
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Jan 10, 2025
1 parent 203ef2f commit eb48eea
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions indra/llwindow/llwindowwin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "llstring.h"
#include "lldir.h"
#include "llsdutil.h"
#include "llsys.h"
#include "llglslshader.h"
#include "llthreadsafequeue.h"
#include "stringize.h"
Expand Down Expand Up @@ -4681,6 +4682,23 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem()

// Alternatively use GetDesc from below to get adapter's memory
UINT64 budget_mb = info.Budget / (1024 * 1024);
if (gGLManager.mIsIntel)
{
U32Megabytes phys_mb = gSysMemory.getPhysicalMemoryKB();
LL_WARNS() << "Physical memory: " << phys_mb << " MB" << LL_ENDL;

if (phys_mb > 0)
{
// Intel uses 'shared' vram, cap it to 25% of total memory
// Todo: consider caping all adapters at least to 50% ram
budget_mb = llmin(budget_mb, (UINT64)(phys_mb * 0.25));
}
else
{
// if no data available, cap to 2Gb
budget_mb = llmin(budget_mb, (UINT64)2048);
}
}
if (gGLManager.mVRAM < (S32)budget_mb)
{
gGLManager.mVRAM = (S32)budget_mb;
Expand Down

0 comments on commit eb48eea

Please sign in to comment.