Improved diagnostics
authorStefanos A. <stapostol@gmail.com>
Mon, 16 Dec 2013 09:39:54 +0000 (10:39 +0100)
committerStefanos A. <stapostol@gmail.com>
Mon, 16 Dec 2013 09:39:54 +0000 (10:39 +0100)
This helps when tracking down GraphicsContext-related issues in SDL2.

Source/OpenTK/Platform/SDL2/Sdl2GraphicsContext.cs

index fae2c03..a34019f 100644 (file)
@@ -73,10 +73,11 @@ namespace OpenTK.Platform.SDL2
                 }
 
                 Mode = GetGLAttributes(SdlContext, out flags);
-                Debug.Print("SDL2 created GraphicsContext (mode: {0}) (flags: {1})",
-                    Mode, flags);
             }
             Handle = GraphicsContext.GetCurrentContext();
+            Debug.Print("SDL2 created GraphicsContext (handle: {0})", Handle);
+            Debug.Print("    GraphicsMode: {0}", Mode);
+            Debug.Print("    GraphicsContextFlags: {0}", flags);
         }
 
         #region Private Members
@@ -332,7 +333,7 @@ namespace OpenTK.Platform.SDL2
             {
                 if (manual)
                 {
-                    Debug.Print("Disposing {0}", GetType());
+                    Debug.Print("Disposing {0} (handle: {1})", GetType(), Handle);
                     lock (SDL.Sync)
                     {
                         SDL.GL.DeleteContext(SdlContext.Handle);
@@ -340,7 +341,8 @@ namespace OpenTK.Platform.SDL2
                 }
                 else
                 {
-                    Debug.WriteLine("Sdl2GraphicsContext leaked, did you forget to call Dispose()?");
+                    Debug.Print("Sdl2GraphicsContext (handle: {0}) leaked, did you forget to call Dispose()?",
+                        Handle);
                 }
                 IsDisposed = true;
             }