summaryrefslogtreecommitdiff
path: root/indra/llrender/llgl.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-03-10 00:41:46 -0600
committerDave Parks <davep@lindenlab.com>2011-03-10 00:41:46 -0600
commit5fd953df8fafb769d31688c47cf3f8634f858de5 (patch)
tree7a0f38e57a4132e78f5e1e61dd316adec7e6355a /indra/llrender/llgl.cpp
parentd46594bf714cd19ebcbf693463c4d39e4c771bb8 (diff)
SH-874 Properly detect available video memory on ATI cards and disable vertex buffer objects when available vram is under 256MB.
Diffstat (limited to 'indra/llrender/llgl.cpp')
-rw-r--r--indra/llrender/llgl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 9354373dba..d1eb4c8be0 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -313,6 +313,7 @@ LLGLManager::LLGLManager() :
mIsDisabled(FALSE),
mHasMultitexture(FALSE),
+ mHasATIMemInfo(FALSE),
mNumTextureUnits(1),
mHasMipMapGeneration(FALSE),
mHasCompressedTextures(FALSE),
@@ -497,6 +498,14 @@ bool LLGLManager::initGL()
// This is called here because it depends on the setting of mIsGF2or4MX, and sets up mHasMultitexture.
initExtensions();
+ if (mHasATIMemInfo)
+ { //ask the gl how much vram is free at startup and attempt to use no more than half of that
+ S32 meminfo[4];
+ glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo);
+
+ mVRAM = meminfo[0]/1024;
+ }
+
if (mHasMultitexture)
{
GLint num_tex_units;
@@ -659,6 +668,7 @@ void LLGLManager::initExtensions()
mHasTextureRectangle = FALSE;
#else // LL_MESA_HEADLESS
mHasMultitexture = glh_init_extensions("GL_ARB_multitexture");
+ mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts);
mHasMipMapGeneration = glh_init_extensions("GL_SGIS_generate_mipmap");
mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color");
mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic");