Improved diagnostics

This helps when tracking down GraphicsContext-related issues in SDL2.
This commit is contained in:
Stefanos A. 2013-12-16 10:39:54 +01:00
parent 6ad91dcc5b
commit 498f16c2bd

View file

@ -73,10 +73,11 @@ namespace OpenTK.Platform.SDL2
} }
Mode = GetGLAttributes(SdlContext, out flags); Mode = GetGLAttributes(SdlContext, out flags);
Debug.Print("SDL2 created GraphicsContext (mode: {0}) (flags: {1})",
Mode, flags);
} }
Handle = GraphicsContext.GetCurrentContext(); Handle = GraphicsContext.GetCurrentContext();
Debug.Print("SDL2 created GraphicsContext (handle: {0})", Handle);
Debug.Print(" GraphicsMode: {0}", Mode);
Debug.Print(" GraphicsContextFlags: {0}", flags);
} }
#region Private Members #region Private Members
@ -332,7 +333,7 @@ namespace OpenTK.Platform.SDL2
{ {
if (manual) if (manual)
{ {
Debug.Print("Disposing {0}", GetType()); Debug.Print("Disposing {0} (handle: {1})", GetType(), Handle);
lock (SDL.Sync) lock (SDL.Sync)
{ {
SDL.GL.DeleteContext(SdlContext.Handle); SDL.GL.DeleteContext(SdlContext.Handle);
@ -340,7 +341,8 @@ namespace OpenTK.Platform.SDL2
} }
else 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; IsDisposed = true;
} }