summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorGraham Madarasz (Graham Linden) <graham@lindenlab.com>2013-02-27 14:39:26 -0800
committerGraham Madarasz (Graham Linden) <graham@lindenlab.com>2013-02-27 14:39:26 -0800
commitd046e606575b2c3714a88e321c88e05441cba4a8 (patch)
treec278c1e3cc7ae83fa7c416583392a8f24a0b1775 /indra/llwindow
parenta0de7a5ca77fbbaba4cafacfce9befbdf42c47b2 (diff)
Fix max VRAM detection on some cards and issues with sequencing of application of mem multiplier
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llopenglview-objc.mm32
-rw-r--r--indra/llwindow/llwindowmacosx.cpp5
2 files changed, 17 insertions, 20 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index a1dece54f4..735ef77cce 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -41,24 +41,20 @@
- (unsigned long)getVramSize
{
- unsigned long vram_bytes = 0;
-
- io_service_t display_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
-
- const void* type_code = IORegistryEntryCreateCFProperty(display_port, CFSTR(kIOFBMemorySizeKey), kCFAllocatorDefault, kNilOptions);
-
- // Ensure we have valid data from IOKit
- if(type_code && CFGetTypeID(type_code) == CFNumberGetTypeID())
- {
- long val;
- // Retrieve actual number...is Apple ever embarrassed by this nonsense?
- //
- CFNumberGetValue((const __CFNumber*)type_code, kCFNumberSInt32Type, &val);
- vram_bytes = (unsigned long)val;
- CFRelease(type_code);
- }
-
- return vram_bytes;
+ CGLRendererInfoObj info = 0;
+ GLint vram_bytes = 0;
+ int num_renderers = 0;
+ CGLError the_err = CGLQueryRendererInfo (CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &num_renderers);
+ if(0 == the_err)
+ {
+ CGLDescribeRenderer (info, 0, kCGLRPTextureMemory, &vram_bytes);
+ CGLDestroyRendererInfo (info);
+ }
+ else
+ {
+ vram_bytes = (256 << 20);
+ }
+ return (unsigned long)vram_bytes;
}
- (void)viewDidMoveToWindow
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index abb3c1e50c..2faebe5dd9 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -511,8 +511,9 @@ void LLWindowMacOSX::destroyContext()
// Close the window
if(mWindow != NULL)
{
- closeWindow(mWindow);
- mWindow = NULL;
+ NSWindowRef dead_window = mWindow;
+ mWindow = NULL;
+ closeWindow(dead_window);
}
}