summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-02-14 02:46:24 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-02-15 19:31:41 +0200
commita2971d84d5aba0c2dcda9ec8274a5c5b72ccd67c (patch)
tree0d1f164e96fdd9aecee9bf6ae103fe561629ffd3 /indra/llwindow/llwindowmacosx.cpp
parent17b5bc9403da9608a9ddff3f989644c98bf936a7 (diff)
Viewer#779 Make RenderMaxVRAMBudget more consistent
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index b317f00ae7..9f71b80e74 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -115,8 +115,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL enable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
- U32 fsaa_samples)
+ U32 fsaa_samples,
+ U32 max_vram)
: LLWindow(NULL, fullscreen, flags)
+ , mMaxVRAM(max_vram)
{
// *HACK: During window construction we get lots of OS events for window
// reshape, activate, etc. that the viewer isn't ready to handle.
@@ -1260,7 +1262,12 @@ U32 LLWindowMacOSX::getAvailableVRAMMegabytes() {
static const U32 mb = 1024*1024;
// We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that.
static const U32 total_factor = 2; // estimated total/textures
- return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb);
+ U32 total_vram = gGLManager.mVRAM;
+ if (mMaxVRAM)
+ {
+ total_vram = llmin(mMaxVRAM, total_vram);
+ }
+ return total_vram - (LLImageGL::getTextureBytesAllocated() * total_factor/mb);
}
//static SInt32 oldWindowLevel;