[EGL] Egl.GetError() now returns ErrorCode
authorthefiddler <stapostol@gmail.com>
Wed, 25 Jun 2014 07:17:20 +0000 (09:17 +0200)
committerthefiddler <stapostol@gmail.com>
Wed, 16 Jul 2014 12:28:27 +0000 (14:28 +0200)
Source/OpenTK/Platform/Egl/Egl.cs
Source/OpenTK/Platform/Egl/EglContext.cs
Source/OpenTK/Platform/Linux/LinuxFactory.cs

index f271f5d..c4fa383 100644 (file)
@@ -50,6 +50,24 @@ namespace OpenTK.Platform.Egl
         VG = Egl.OPENVG_BIT,
     }
 
+    enum ErrorCode
+    {
+        SUCCESS = 12288,
+        NOT_INITIALIZED = 12289,
+        BAD_ACCESS = 12290,
+        BAD_ALLOC = 12291,
+        BAD_ATTRIBUTE = 12292,
+        BAD_CONFIG = 12293,
+        BAD_CONTEXT = 12294,
+        BAD_CURRENT_SURFACE = 12295,
+        BAD_DISPLAY = 12296,
+        BAD_MATCH = 12297,
+        BAD_NATIVE_PIXMAP = 12298,
+        BAD_NATIVE_WINDOW = 12299,
+        BAD_PARAMETER = 12300,
+        BAD_SURFACE = 12301,
+    }
+
     static partial class Egl
     {
         public const int VERSION_1_0 = 1;
@@ -60,20 +78,6 @@ namespace OpenTK.Platform.Egl
         public const int FALSE = 0;
         public const int TRUE = 1;
         public const int DONT_CARE = -1;
-        public const int SUCCESS = 12288;
-        public const int NOT_INITIALIZED = 12289;
-        public const int BAD_ACCESS = 12290;
-        public const int BAD_ALLOC = 12291;
-        public const int BAD_ATTRIBUTE = 12292;
-        public const int BAD_CONFIG = 12293;
-        public const int BAD_CONTEXT = 12294;
-        public const int BAD_CURRENT_SURFACE = 12295;
-        public const int BAD_DISPLAY = 12296;
-        public const int BAD_MATCH = 12297;
-        public const int BAD_NATIVE_PIXMAP = 12298;
-        public const int BAD_NATIVE_WINDOW = 12299;
-        public const int BAD_PARAMETER = 12300;
-        public const int BAD_SURFACE = 12301;
         public const int CONTEXT_LOST = 12302;
         public const int BUFFER_SIZE = 12320;
         public const int ALPHA_SIZE = 12321;
@@ -178,7 +182,7 @@ namespace OpenTK.Platform.Egl
         public const int ALPHA_FORMAT_PRE = VG_ALPHA_FORMAT_PRE;
 
         [DllImportAttribute("libEGL.dll", EntryPoint = "eglGetError")]
-        public static extern int GetError();
+        public static extern ErrorCode GetError();
 
         [DllImportAttribute("libEGL.dll", EntryPoint = "eglGetDisplay")]
         public static extern EGLDisplay GetDisplay(EGLNativeDisplayType display_id);
index 37398f0..a6f961e 100644 (file)
@@ -133,7 +133,8 @@ namespace OpenTK.Platform.Egl
                 if (Egl.SwapInterval(WindowInfo.Display, value))
                     swap_interval = value;
                 else
-                    Debug.Print("[Warning] Egl.SwapInterval({0}, {1}) failed.", WindowInfo.Display, value);
+                    Debug.Print("[Warning] Egl.SwapInterval({0}, {1}) failed. Error: {2}",
+                        WindowInfo.Display, value, Egl.GetError());
             }
         }
 
index 2c962ed..3066120 100644 (file)
@@ -83,7 +83,7 @@ namespace OpenTK.Platform.Linux
             int major, minor;
             if (!Egl.Initialize(display, out major, out minor))
             {
-                int error = Egl.GetError();
+                ErrorCode error = Egl.GetError();
                 throw new NotSupportedException("[KMS] Failed to initialize EGL display. Error code: " + error);
             }
             Debug.Print("[KMS] EGL {0}.{1} initialized successfully on display {2:x}", major, minor, display);