summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowmacosx.cpp
diff options
context:
space:
mode:
authorHoward Stearns <howard.stearns@gmail.com>2022-06-13 13:47:34 -0700
committerHoward Stearns <howard.stearns@gmail.com>2022-06-13 13:52:06 -0700
commit758a602f20340c5efde626fcace5a11133cfb859 (patch)
treea3c161bcdbc5c9e66c273cf0d87eec80cb41a802 /indra/llwindow/llwindowmacosx.cpp
parentb879c6f3f19c4f2b6791eae67194dcc5f0a020cb (diff)
SL-17485 - mac getVramSize should return all vram, not just texture-specific, and use to compute getAvailableVRAMMegabytes.
Diffstat (limited to 'indra/llwindow/llwindowmacosx.cpp')
-rw-r--r--indra/llwindow/llwindowmacosx.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index bc4f07941b..4bcb9b3aef 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1222,6 +1222,16 @@ F32 LLWindowMacOSX::getPixelAspectRatio()
return 1.f;
}
+U32 LLWindowMacOSX::getAvailableVRAMMegabytes() {
+ // MTL (and MoltenVK) has some additional gpu data, such as recommendedMaxWorkingSetSize and currentAllocatedSize.
+ // But these are not available for OpenGL and/or our current mimimum OS version.
+ // So we will estimate.
+ 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);
+}
+
//static SInt32 oldWindowLevel;
// MBW -- XXX -- There's got to be a better way than this. Find it, please...