[osx] fixed, non-accelerated renderer fallback was not working. Need to check created...
authorS. Davilla <davilla@4pi.com>
Tue, 15 Feb 2011 17:50:18 +0000 (12:50 -0500)
committertheuni <theuni-nospam-@xbmc.org>
Thu, 17 Feb 2011 22:12:17 +0000 (17:12 -0500)
(cherry picked from commit b9990a4af141eb6fb02b8b7b1aef1b0ba1b8f7d0)

xbmc/osx/WinSystemOSX.mm

index 0950d4f..a382bcf 100644 (file)
@@ -630,6 +630,8 @@ void* Cocoa_GL_CreateContext(void* pixFmt, void* shareCtx)
 
 void* CWinSystemOSX::CreateWindowedContext(void* shareCtx)
 {
+  NSOpenGLContext* newContext = NULL;
+
   NSOpenGLPixelFormatAttribute wattrs[] =
   {
     NSOpenGLPFADoubleBuffer,
@@ -639,9 +641,14 @@ void* CWinSystemOSX::CreateWindowedContext(void* shareCtx)
     NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)8,
     (NSOpenGLPixelFormatAttribute)0
   };
-  
+
   NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:wattrs];
-  if (!pixFmt)
+  
+  newContext = [[NSOpenGLContext alloc] initWithFormat:(NSOpenGLPixelFormat*)pixFmt
+    shareContext:(NSOpenGLContext*)shareCtx];
+  [pixFmt release];
+
+  if (!newContext)
   {
     // bah, try again for non-accelerated renderer
     NSOpenGLPixelFormatAttribute wattrs2[] =
@@ -653,13 +660,11 @@ void* CWinSystemOSX::CreateWindowedContext(void* shareCtx)
       (NSOpenGLPixelFormatAttribute)0
     };
     NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:wattrs2];
-    if (!pixFmt)
-      return nil;
+
+    newContext = [[NSOpenGLContext alloc] initWithFormat:(NSOpenGLPixelFormat*)pixFmt
+      shareContext:(NSOpenGLContext*)shareCtx];
+    [pixFmt release];
   }
-    
-  NSOpenGLContext* newContext = [[NSOpenGLContext alloc] initWithFormat:(NSOpenGLPixelFormat*)pixFmt
-    shareContext:(NSOpenGLContext*)shareCtx];
-  [pixFmt release];
 
   return newContext;
 }