Removed unused WGL methods
authorStefanos A. <stapostol@gmail.com>
Thu, 28 Nov 2013 22:22:35 +0000 (23:22 +0100)
committerStefanos A. <stapostol@gmail.com>
Thu, 28 Nov 2013 22:22:35 +0000 (23:22 +0100)
WGL was autogenerated a few years ago but never touched after that.
Since we use a tiny fraction of all available methods, it makes sense to
remove the unused ones. This reduces dll size and improves startup
times.

Source/OpenTK/Platform/Windows/Bindings/Wgl.cs
Source/OpenTK/Platform/Windows/Bindings/WglCore.cs [deleted file]
Source/OpenTK/Platform/Windows/Bindings/WglDelegates.cs
Source/OpenTK/Platform/Windows/WglHelper.cs
Source/OpenTK/Platform/Windows/WinGLContext.cs
Source/OpenTK/Platform/Windows/WinGraphicsMode.cs

index ab794a8d2e67ee2e5474738141701acd394a3e18..4668f629a1bd0a53903b686147d674ef9a8e39b4 100644 (file)
+#region License
+//
+// The Open Toolkit Library License
+//
+// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights to 
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+// the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+#endregion
+
+using System;
+using System.Runtime.InteropServices;
+using System.Security;
+
 namespace OpenTK.Platform.Windows
 {
-    using System;
-    using System.Runtime.InteropServices;
-    #pragma warning disable 3019
-    #pragma warning disable 1591
+#pragma warning disable 3019
+#pragma warning disable 1591
 
     static partial class Wgl
     {
-
-        public static 
-        IntPtr CreateContext(IntPtr hDc)
-        {
-            return Delegates.wglCreateContext((IntPtr)hDc);
-        }
-
-        public static 
-        Boolean DeleteContext(IntPtr oldContext)
-        {
-            return Delegates.wglDeleteContext((IntPtr)oldContext);
-        }
-
-        public static 
-        IntPtr GetCurrentContext()
-        {
-            return Delegates.wglGetCurrentContext();
-        }
-
-        public static 
-        Boolean MakeCurrent(IntPtr hDc, IntPtr newContext)
-        {
-            return Delegates.wglMakeCurrent((IntPtr)hDc, (IntPtr)newContext);
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask)
-        {
-            return Delegates.wglCopyContext((IntPtr)hglrcSrc, (IntPtr)hglrcDst, (UInt32)mask);
-        }
-
-        public static 
-        Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, Int32 mask)
-        {
-            return Delegates.wglCopyContext((IntPtr)hglrcSrc, (IntPtr)hglrcDst, (UInt32)mask);
-        }
-
-        public static 
-        int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor[] pPfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* pPfd_ptr = pPfd)
-                {
-                    return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd_ptr);
-                }
-            }
-        }
-
-        public static 
-        int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* pPfd_ptr = &pPfd)
-                {
-                    return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd_ptr);
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd)
-        {
-            return Delegates.wglChoosePixelFormat((IntPtr)hDc, (PixelFormatDescriptor*)pPfd);
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor[] ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
-                {
-                    return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        public static 
-        int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, PixelFormatDescriptor[] ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
-                {
-                    return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, ref PixelFormatDescriptor ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
-                {
-                    return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        public static 
-        int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, ref PixelFormatDescriptor ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
-                {
-                    return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd)
-        {
-            return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd);
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, Int32 cjpfd, PixelFormatDescriptor* ppfd)
-        {
-            return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (PixelFormatDescriptor*)ppfd);
-        }
-
-        public static 
-        IntPtr GetCurrentDC()
-        {
-            return Delegates.wglGetCurrentDC();
-        }
-
-        public static 
-        IntPtr GetDefaultProcAddres(String lpszProc)
-        {
-            return Delegates.wglGetDefaultProcAddress((String)lpszProc);
-        }
-
-        public static 
-        IntPtr GetProcAddres(String lpszProc)
-        {
-            return Delegates.wglGetProcAddress((String)lpszProc);
-        }
-
-        public static 
-        int GetPixelFormat(IntPtr hdc)
-        {
-            return Delegates.wglGetPixelFormat((IntPtr)hdc);
-        }
-
-        public static 
-        Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor[] ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = ppfd)
-                {
-                    return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        public static 
-        Boolean SetPixelFormat(IntPtr hdc, int ipfd, ref PixelFormatDescriptor ppfd)
-        {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd_ptr = &ppfd)
-                {
-                    return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd_ptr);
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd)
-        {
-            return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (PixelFormatDescriptor*)ppfd);
-        }
-
-        public static 
-        Boolean SwapBuffers(IntPtr hdc)
-        {
-            return Delegates.wglSwapBuffers((IntPtr)hdc);
-        }
-
-        public static 
-        Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource)
-        {
-            return Delegates.wglShareLists((IntPtr)hrcSrvShare, (IntPtr)hrcSrvSource);
-        }
-
-        public static 
-        Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc)
-        {
-            return Delegates.wglMakeContextCurrentEXT((IntPtr)hDrawDC, (IntPtr)hReadDC, (IntPtr)hglrc);
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        Boolean ChoosePixelFormatEXT(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, UInt32 nMaxFormats, [Out] int[] piFormats, [Out] UInt32[] nNumFormats)
-        {
-            unsafe
-            {
-                fixed (int* piAttribIList_ptr = piAttribIList)
-                fixed (Single* pfAttribFList_ptr = pfAttribFList)
-                fixed (int* piFormats_ptr = piFormats)
-                fixed (UInt32* nNumFormats_ptr = nNumFormats)
-                {
-                    return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                }
-            }
-        }
-
-        public static 
-        Boolean ChoosePixelFormatEXT(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, Int32 nMaxFormats, [Out] int[] piFormats, [Out] Int32[] nNumFormats)
-        {
-            unsafe
-            {
-                fixed (int* piAttribIList_ptr = piAttribIList)
-                fixed (Single* pfAttribFList_ptr = pfAttribFList)
-                fixed (int* piFormats_ptr = piFormats)
-                fixed (Int32* nNumFormats_ptr = nNumFormats)
-                {
-                    return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        Boolean ChoosePixelFormatEXT(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, UInt32 nMaxFormats, [Out] out int piFormats, [Out] out UInt32 nNumFormats)
-        {
-            unsafe
-            {
-                fixed (int* piAttribIList_ptr = &piAttribIList)
-                fixed (Single* pfAttribFList_ptr = &pfAttribFList)
-                fixed (int* piFormats_ptr = &piFormats)
-                fixed (UInt32* nNumFormats_ptr = &nNumFormats)
-                {
-                    Boolean retval = Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                    piFormats = *piFormats_ptr;
-                    nNumFormats = *nNumFormats_ptr;
-                    return retval;
-                }
-            }
-        }
-
-        public static 
-        Boolean ChoosePixelFormatEXT(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, Int32 nMaxFormats, [Out] out int piFormats, [Out] out Int32 nNumFormats)
-        {
-            unsafe
-            {
-                fixed (int* piAttribIList_ptr = &piAttribIList)
-                fixed (Single* pfAttribFList_ptr = &pfAttribFList)
-                fixed (int* piFormats_ptr = &piFormats)
-                fixed (Int32* nNumFormats_ptr = &nNumFormats)
-                {
-                    Boolean retval = Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                    piFormats = *piFormats_ptr;
-                    nNumFormats = *nNumFormats_ptr;
-                    return retval;
-                }
-            }
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats)
-        {
-            return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
-        }
-
-        [System.CLSCompliant(false)]
-        public static 
-        unsafe Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, Int32 nMaxFormats, [Out] int* piFormats, [Out] Int32* nNumFormats)
-        {
-            return Delegates.wglChoosePixelFormatEXT((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
-        }
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglCreateContext", ExactSpelling = true, SetLastError = true)]
+        internal extern static IntPtr CreateContext(IntPtr hDc);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglDeleteContext", ExactSpelling = true, SetLastError = true)]
+        internal extern static Boolean DeleteContext(IntPtr oldContext);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglGetCurrentContext", ExactSpelling = true, SetLastError = true)]
+        internal extern static IntPtr GetCurrentContext();
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true, SetLastError = true)]
+        internal extern static Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglCopyContext", ExactSpelling = true, SetLastError = true)]
+        internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, ref PixelFormatDescriptor pPfd);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true, SetLastError = true)]
+        internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, out PixelFormatDescriptor ppfd);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true, SetLastError = true)]
+        internal extern static IntPtr GetCurrentDC();
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
+        internal extern static IntPtr GetProcAddress(String lpszProc);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
+        internal extern static IntPtr GetProcAddress(IntPtr lpszProc);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglGetPixelFormat", ExactSpelling = true, SetLastError = true)]
+        internal extern static int GetPixelFormat(IntPtr hdc);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true, SetLastError = true)]
+        internal extern static Boolean SetPixelFormat(IntPtr hdc, int ipfd, ref PixelFormatDescriptor ppfd);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true, SetLastError = true)]
+        internal extern static Boolean SwapBuffers(IntPtr hdc);
+        [SuppressUnmanagedCodeSecurity]
+        [DllImport(Wgl.Library, EntryPoint = "wglShareLists", ExactSpelling = true, SetLastError = true)]
+        internal extern static Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
 
         public static partial class Arb
         {
@@ -327,39 +108,8 @@ namespace OpenTK.Platform.Windows
                     }
                 }
             }
-            
-            [System.CLSCompliant(false)]
-            public static 
-            IntPtr CreateBufferRegion(IntPtr hDC, int iLayerPlane, UInt32 uType)
-            {
-                return Delegates.wglCreateBufferRegionARB((IntPtr)hDC, (int)iLayerPlane, (UInt32)uType);
-            }
-
-            public static 
-            IntPtr CreateBufferRegion(IntPtr hDC, int iLayerPlane, Int32 uType)
-            {
-                return Delegates.wglCreateBufferRegionARB((IntPtr)hDC, (int)iLayerPlane, (UInt32)uType);
-            }
-
-            public static 
-            void DeleteBufferRegion(IntPtr hRegion)
-            {
-                Delegates.wglDeleteBufferRegionARB((IntPtr)hRegion);
-            }
-
-            public static 
-            Boolean SaveBufferRegion(IntPtr hRegion, int x, int y, int width, int height)
-            {
-                return Delegates.wglSaveBufferRegionARB((IntPtr)hRegion, (int)x, (int)y, (int)width, (int)height);
-            }
-
-            public static 
-            Boolean RestoreBufferRegion(IntPtr hRegion, int x, int y, int width, int height, int xSrc, int ySrc)
-            {
-                return Delegates.wglRestoreBufferRegionARB((IntPtr)hRegion, (int)x, (int)y, (int)width, (int)height, (int)xSrc, (int)ySrc);
-            }
 
-            public static 
+            public static
             string GetExtensionsString(IntPtr hdc)
             {
                 unsafe
@@ -368,21 +118,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int[] piAttributes, [Out] int[] piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = piAttributes)
-                    fixed (int* piValues_ptr = piValues)
-                    {
-                        return Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                    }
-                }
-            }
-
-            public static 
+            public static
             Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int[] piAttributes, [Out] int[] piValues)
             {
                 unsafe
@@ -395,23 +131,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, ref int piAttributes, [Out] out int piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (int* piValues_ptr = &piValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                        piValues = *piValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            public static 
+            public static
             Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, ref int piAttributes, [Out] out int piValues)
             {
                 unsafe
@@ -426,22 +146,14 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] int* piValues)
-            {
-                return Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int* piAttributes, [Out] int* piValues)
             {
                 return Delegates.wglGetPixelFormatAttribivARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
             }
 
             [System.CLSCompliant(false)]
-            public static 
+            public static
             Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int[] piAttributes, [Out] Single[] pfValues)
             {
                 unsafe
@@ -454,7 +166,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            public static 
+            public static
             Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int[] piAttributes, [Out] Single[] pfValues)
             {
                 unsafe
@@ -467,23 +179,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, ref int piAttributes, [Out] out Single pfValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (Single* pfValues_ptr = &pfValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
-                        pfValues = *pfValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            public static 
+            public static
             Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, ref int piAttributes, [Out] out Single pfValues)
             {
                 unsafe
@@ -499,36 +195,13 @@ namespace OpenTK.Platform.Windows
             }
 
             [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] Single* pfValues)
-            {
-                return Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, int* piAttributes, [Out] Single* pfValues)
             {
                 return Delegates.wglGetPixelFormatAttribfvARB((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean ChoosePixelFormat(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, UInt32 nMaxFormats, [Out] int[] piFormats, [Out] UInt32[] nNumFormats)
-            {
-                unsafe
-                {
-                    fixed (int* piAttribIList_ptr = piAttribIList)
-                    fixed (Single* pfAttribFList_ptr = pfAttribFList)
-                    fixed (int* piFormats_ptr = piFormats)
-                    fixed (UInt32* nNumFormats_ptr = nNumFormats)
-                    {
-                        return Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                    }
-                }
-            }
-
-            public static 
+            public static
             Boolean ChoosePixelFormat(IntPtr hdc, int[] piAttribIList, Single[] pfAttribFList, Int32 nMaxFormats, [Out] int[] piFormats, [Out] Int32[] nNumFormats)
             {
                 unsafe
@@ -543,26 +216,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean ChoosePixelFormat(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, UInt32 nMaxFormats, [Out] out int piFormats, [Out] out UInt32 nNumFormats)
-            {
-                unsafe
-                {
-                    fixed (int* piAttribIList_ptr = &piAttribIList)
-                    fixed (Single* pfAttribFList_ptr = &pfAttribFList)
-                    fixed (int* piFormats_ptr = &piFormats)
-                    fixed (UInt32* nNumFormats_ptr = &nNumFormats)
-                    {
-                        Boolean retval = Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList_ptr, (Single*)pfAttribFList_ptr, (UInt32)nMaxFormats, (int*)piFormats_ptr, (UInt32*)nNumFormats_ptr);
-                        piFormats = *piFormats_ptr;
-                        nNumFormats = *nNumFormats_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            public static 
+            public static
             Boolean ChoosePixelFormat(IntPtr hdc, ref int piAttribIList, ref Single pfAttribFList, Int32 nMaxFormats, [Out] out int piFormats, [Out] out Int32 nNumFormats)
             {
                 unsafe
@@ -581,32 +235,25 @@ namespace OpenTK.Platform.Windows
             }
 
             [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean ChoosePixelFormat(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats)
-            {
-                return Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe Boolean ChoosePixelFormat(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, Int32 nMaxFormats, [Out] int* piFormats, [Out] Int32* nNumFormats)
             {
                 return Delegates.wglChoosePixelFormatARB((IntPtr)hdc, (int*)piAttribIList, (Single*)pfAttribFList, (UInt32)nMaxFormats, (int*)piFormats, (UInt32*)nNumFormats);
             }
 
-            public static 
+            public static
             Boolean MakeContextCurrent(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc)
             {
                 return Delegates.wglMakeContextCurrentARB((IntPtr)hDrawDC, (IntPtr)hReadDC, (IntPtr)hglrc);
             }
 
-            public static 
+            public static
             IntPtr GetCurrentReadDC()
             {
                 return Delegates.wglGetCurrentReadDCARB();
             }
 
-            public static 
+            public static
             IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int[] piAttribList)
             {
                 unsafe
@@ -618,7 +265,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            public static 
+            public static
             IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, ref int piAttribList)
             {
                 unsafe
@@ -631,31 +278,31 @@ namespace OpenTK.Platform.Windows
             }
 
             [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList)
             {
                 return Delegates.wglCreatePbufferARB((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList);
             }
 
-            public static 
+            public static
             IntPtr GetPbufferDC(IntPtr hPbuffer)
             {
                 return Delegates.wglGetPbufferDCARB((IntPtr)hPbuffer);
             }
 
-            public static 
+            public static
             int ReleasePbufferDC(IntPtr hPbuffer, IntPtr hDC)
             {
                 return Delegates.wglReleasePbufferDCARB((IntPtr)hPbuffer, (IntPtr)hDC);
             }
 
-            public static 
+            public static
             Boolean DestroyPbuffer(IntPtr hPbuffer)
             {
                 return Delegates.wglDestroyPbufferARB((IntPtr)hPbuffer);
             }
 
-            public static 
+            public static
             Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int[] piValue)
             {
                 unsafe
@@ -667,7 +314,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            public static 
+            public static
             Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] out int piValue)
             {
                 unsafe
@@ -682,25 +329,25 @@ namespace OpenTK.Platform.Windows
             }
 
             [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int* piValue)
             {
                 return Delegates.wglQueryPbufferARB((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue);
             }
 
-            public static 
+            public static
             Boolean BindTexImage(IntPtr hPbuffer, int iBuffer)
             {
                 return Delegates.wglBindTexImageARB((IntPtr)hPbuffer, (int)iBuffer);
             }
 
-            public static 
+            public static
             Boolean ReleaseTexImage(IntPtr hPbuffer, int iBuffer)
             {
                 return Delegates.wglReleaseTexImageARB((IntPtr)hPbuffer, (int)iBuffer);
             }
 
-            public static 
+            public static
             Boolean SetPbufferAttrib(IntPtr hPbuffer, int[] piAttribList)
             {
                 unsafe
@@ -712,7 +359,7 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            public static 
+            public static
             Boolean SetPbufferAttrib(IntPtr hPbuffer, ref int piAttribList)
             {
                 unsafe
@@ -725,120 +372,16 @@ namespace OpenTK.Platform.Windows
             }
 
             [System.CLSCompliant(false)]
-            public static 
+            public static
             unsafe Boolean SetPbufferAttrib(IntPtr hPbuffer, int* piAttribList)
             {
                 return Delegates.wglSetPbufferAttribARB((IntPtr)hPbuffer, (int*)piAttribList);
             }
-
         }
 
         public static partial class Ext
         {
-            [System.CLSCompliant(false)]
-            public static 
-            bool CreateDisplayColorTable(UInt16 id)
-            {
-                return Delegates.wglCreateDisplayColorTableEXT((UInt16)id);
-            }
-
-            public static 
-            bool CreateDisplayColorTable(Int16 id)
-            {
-                return Delegates.wglCreateDisplayColorTableEXT((UInt16)id);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            bool LoadDisplayColorTable(UInt16[] table, UInt32 length)
-            {
-                unsafe
-                {
-                    fixed (UInt16* table_ptr = table)
-                    {
-                        return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
-                    }
-                }
-            }
-
-            public static 
-            bool LoadDisplayColorTable(Int16[] table, Int32 length)
-            {
-                unsafe
-                {
-                    fixed (Int16* table_ptr = table)
-                    {
-                        return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            bool LoadDisplayColorTable(ref UInt16 table, UInt32 length)
-            {
-                unsafe
-                {
-                    fixed (UInt16* table_ptr = &table)
-                    {
-                        return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
-                    }
-                }
-            }
-
-            public static 
-            bool LoadDisplayColorTable(ref Int16 table, Int32 length)
-            {
-                unsafe
-                {
-                    fixed (Int16* table_ptr = &table)
-                    {
-                        return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table_ptr, (UInt32)length);
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe bool LoadDisplayColorTable(UInt16* table, UInt32 length)
-            {
-                return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table, (UInt32)length);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe bool LoadDisplayColorTable(Int16* table, Int32 length)
-            {
-                return Delegates.wglLoadDisplayColorTableEXT((UInt16*)table, (UInt32)length);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            bool BindDisplayColorTable(UInt16 id)
-            {
-                return Delegates.wglBindDisplayColorTableEXT((UInt16)id);
-            }
-
-            public static 
-            bool BindDisplayColorTable(Int16 id)
-            {
-                return Delegates.wglBindDisplayColorTableEXT((UInt16)id);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            void DestroyDisplayColorTable(UInt16 id)
-            {
-                Delegates.wglDestroyDisplayColorTableEXT((UInt16)id);
-            }
-
-            public static 
-            void DestroyDisplayColorTable(Int16 id)
-            {
-                Delegates.wglDestroyDisplayColorTableEXT((UInt16)id);
-            }
-
-            public static 
+            public static
             string GetExtensionsString()
             {
                 unsafe
@@ -847,249 +390,13 @@ namespace OpenTK.Platform.Windows
                 }
             }
 
-            public static 
-            IntPtr GetCurrentReadDC()
-            {
-                return Delegates.wglGetCurrentReadDCEXT();
-            }
-
-            public static 
-            IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int[] piAttribList)
-            {
-                unsafe
-                {
-                    fixed (int* piAttribList_ptr = piAttribList)
-                    {
-                        return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList_ptr);
-                    }
-                }
-            }
-
-            public static 
-            IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, ref int piAttribList)
-            {
-                unsafe
-                {
-                    fixed (int* piAttribList_ptr = &piAttribList)
-                    {
-                        return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList_ptr);
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe IntPtr CreatePbuffer(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList)
-            {
-                return Delegates.wglCreatePbufferEXT((IntPtr)hDC, (int)iPixelFormat, (int)iWidth, (int)iHeight, (int*)piAttribList);
-            }
-
-            public static 
-            IntPtr GetPbufferDC(IntPtr hPbuffer)
-            {
-                return Delegates.wglGetPbufferDCEXT((IntPtr)hPbuffer);
-            }
-
-            public static 
-            int ReleasePbufferDC(IntPtr hPbuffer, IntPtr hDC)
-            {
-                return Delegates.wglReleasePbufferDCEXT((IntPtr)hPbuffer, (IntPtr)hDC);
-            }
-
-            public static 
-            Boolean DestroyPbuffer(IntPtr hPbuffer)
-            {
-                return Delegates.wglDestroyPbufferEXT((IntPtr)hPbuffer);
-            }
-
-            public static 
-            Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int[] piValue)
-            {
-                unsafe
-                {
-                    fixed (int* piValue_ptr = piValue)
-                    {
-                        return Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue_ptr);
-                    }
-                }
-            }
-
-            public static 
-            Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] out int piValue)
-            {
-                unsafe
-                {
-                    fixed (int* piValue_ptr = &piValue)
-                    {
-                        Boolean retval = Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue_ptr);
-                        piValue = *piValue_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean QueryPbuffer(IntPtr hPbuffer, int iAttribute, [Out] int* piValue)
-            {
-                return Delegates.wglQueryPbufferEXT((IntPtr)hPbuffer, (int)iAttribute, (int*)piValue);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int[] piAttributes, [Out] int[] piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = piAttributes)
-                    fixed (int* piValues_ptr = piValues)
-                    {
-                        return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                    }
-                }
-            }
-
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int[] piAttributes, [Out] int[] piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = piAttributes)
-                    fixed (int* piValues_ptr = piValues)
-                    {
-                        return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] out int piAttributes, [Out] out int piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (int* piValues_ptr = &piValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                        piAttributes = *piAttributes_ptr;
-                        piValues = *piValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] out int piAttributes, [Out] out int piValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (int* piValues_ptr = &piValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (int*)piValues_ptr);
-                        piAttributes = *piAttributes_ptr;
-                        piValues = *piValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues)
-            {
-                return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int* piAttributes, [Out] int* piValues)
-            {
-                return Delegates.wglGetPixelFormatAttribivEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (int*)piValues);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int[] piAttributes, [Out] Single[] pfValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = piAttributes)
-                    fixed (Single* pfValues_ptr = pfValues)
-                    {
-                        return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
-                    }
-                }
-            }
-
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int[] piAttributes, [Out] Single[] pfValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = piAttributes)
-                    fixed (Single* pfValues_ptr = pfValues)
-                    {
-                        return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] out int piAttributes, [Out] out Single pfValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (Single* pfValues_ptr = &pfValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
-                        piAttributes = *piAttributes_ptr;
-                        pfValues = *pfValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            public static 
-            Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] out int piAttributes, [Out] out Single pfValues)
-            {
-                unsafe
-                {
-                    fixed (int* piAttributes_ptr = &piAttributes)
-                    fixed (Single* pfValues_ptr = &pfValues)
-                    {
-                        Boolean retval = Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes_ptr, (Single*)pfValues_ptr);
-                        piAttributes = *piAttributes_ptr;
-                        pfValues = *pfValues_ptr;
-                        return retval;
-                    }
-                }
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues)
-            {
-                return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
-            }
-
-            [System.CLSCompliant(false)]
-            public static 
-            unsafe Boolean GetPixelFormatAttrib(IntPtr hdc, int iPixelFormat, int iLayerPlane, Int32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues)
-            {
-                return Delegates.wglGetPixelFormatAttribfvEXT((IntPtr)hdc, (int)iPixelFormat, (int)iLayerPlane, (UInt32)nAttributes, (int*)piAttributes, (Single*)pfValues);
-            }
-
-            public static 
+            public static
             Boolean SwapInterval(int interval)
             {
                 return Delegates.wglSwapIntervalEXT((int)interval);
             }
 
-            public static 
+            public static
             int GetSwapInterval()
             {
                 return Delegates.wglGetSwapIntervalEXT();
diff --git a/Source/OpenTK/Platform/Windows/Bindings/WglCore.cs b/Source/OpenTK/Platform/Windows/Bindings/WglCore.cs
deleted file mode 100644 (file)
index b0e6213..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-namespace OpenTK.Platform.Windows
-{
-    using System;
-    using System.Runtime.InteropServices;
-    #pragma warning disable 3019
-    #pragma warning disable 1591
-
-    partial class Wgl
-    {
-
-        internal static partial class Imports
-        {
-
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCreateContext", ExactSpelling = true, SetLastError=true)]
-            internal extern static IntPtr CreateContext(IntPtr hDc);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDeleteContext", ExactSpelling = true, SetLastError = true)]
-            internal extern static Boolean DeleteContext(IntPtr oldContext);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentContext", ExactSpelling = true, SetLastError=true)]
-            internal extern static IntPtr GetCurrentContext();
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true, SetLastError=true)]
-            internal extern static Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCopyContext", ExactSpelling = true, SetLastError = true)]
-            internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true, SetLastError = true)]
-            internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true, SetLastError = true)]
-            internal extern static IntPtr GetCurrentDC();
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
-            internal extern static IntPtr GetProcAddress(String lpszProc);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetPixelFormat", ExactSpelling = true, SetLastError = true)]
-            internal extern static int GetPixelFormat(IntPtr hdc);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true, SetLastError = true)]
-            internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true, SetLastError = true)]
-            internal extern static Boolean SwapBuffers(IntPtr hdc);
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            [System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglShareLists", ExactSpelling = true, SetLastError = true)]
-            internal extern static Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
-        }
-    }
-}
index ef2f16fc08ef844b2bfbc455ecd356f9032a270d..0a3cc695c659b3a095c869f342f3311fbaefdcdb 100644 (file)
@@ -1,3 +1,30 @@
+#region License
+//
+// The Open Toolkit Library License
+//
+// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights to 
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+// the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+#endregion
+
 namespace OpenTK.Platform.Windows
 {
     using System;
@@ -10,64 +37,10 @@ namespace OpenTK.Platform.Windows
     {
         internal static partial class Delegates
         {
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr CreateContext(IntPtr hDc);
-            internal static CreateContext wglCreateContext;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean DeleteContext(IntPtr oldContext);
-            internal static DeleteContext wglDeleteContext;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetCurrentContext();
-            internal static GetCurrentContext wglGetCurrentContext;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
-            internal static MakeCurrent wglMakeCurrent;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
-            internal static CopyContext wglCopyContext;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
-            internal unsafe static ChoosePixelFormat wglChoosePixelFormat;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
-            internal unsafe static DescribePixelFormat wglDescribePixelFormat;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetCurrentDC();
-            internal static GetCurrentDC wglGetCurrentDC;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetDefaultProcAddress(String lpszProc);
-            internal static GetDefaultProcAddress wglGetDefaultProcAddress;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetProcAddress(String lpszProc);
-            internal static GetProcAddress wglGetProcAddress;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate int GetPixelFormat(IntPtr hdc);
-            internal static GetPixelFormat wglGetPixelFormat;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
-            internal unsafe static SetPixelFormat wglSetPixelFormat;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean SwapBuffers(IntPtr hdc);
-            internal static SwapBuffers wglSwapBuffers;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
-            internal static ShareLists wglShareLists;
             [System.Security.SuppressUnmanagedCodeSecurity()]
             internal unsafe delegate IntPtr CreateContextAttribsARB(IntPtr hDC, IntPtr hShareContext, int* attribList);
             internal unsafe static CreateContextAttribsARB wglCreateContextAttribsARB;
             [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr CreateBufferRegionARB(IntPtr hDC, int iLayerPlane, UInt32 uType);
-            internal static CreateBufferRegionARB wglCreateBufferRegionARB;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate void DeleteBufferRegionARB(IntPtr hRegion);
-            internal static DeleteBufferRegionARB wglDeleteBufferRegionARB;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean SaveBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height);
-            internal static SaveBufferRegionARB wglSaveBufferRegionARB;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean RestoreBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
-            internal static RestoreBufferRegionARB wglRestoreBufferRegionARB;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
             internal delegate IntPtr GetExtensionsStringARB(IntPtr hdc);
             internal static GetExtensionsStringARB wglGetExtensionsStringARB;
             [System.Security.SuppressUnmanagedCodeSecurity()]
@@ -110,51 +83,9 @@ namespace OpenTK.Platform.Windows
             internal unsafe delegate Boolean SetPbufferAttribARB(IntPtr hPbuffer, int* piAttribList);
             internal unsafe static SetPbufferAttribARB wglSetPbufferAttribARB;
             [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate bool CreateDisplayColorTableEXT(UInt16 id);
-            internal static CreateDisplayColorTableEXT wglCreateDisplayColorTableEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate bool LoadDisplayColorTableEXT(UInt16* table, UInt32 length);
-            internal unsafe static LoadDisplayColorTableEXT wglLoadDisplayColorTableEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate bool BindDisplayColorTableEXT(UInt16 id);
-            internal static BindDisplayColorTableEXT wglBindDisplayColorTableEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate void DestroyDisplayColorTableEXT(UInt16 id);
-            internal static DestroyDisplayColorTableEXT wglDestroyDisplayColorTableEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
             internal delegate IntPtr GetExtensionsStringEXT();
             internal static GetExtensionsStringEXT wglGetExtensionsStringEXT;
             [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc);
-            internal static MakeContextCurrentEXT wglMakeContextCurrentEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetCurrentReadDCEXT();
-            internal static GetCurrentReadDCEXT wglGetCurrentReadDCEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate IntPtr CreatePbufferEXT(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList);
-            internal unsafe static CreatePbufferEXT wglCreatePbufferEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate IntPtr GetPbufferDCEXT(IntPtr hPbuffer);
-            internal static GetPbufferDCEXT wglGetPbufferDCEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate int ReleasePbufferDCEXT(IntPtr hPbuffer, IntPtr hDC);
-            internal static ReleasePbufferDCEXT wglReleasePbufferDCEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal delegate Boolean DestroyPbufferEXT(IntPtr hPbuffer);
-            internal static DestroyPbufferEXT wglDestroyPbufferEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate Boolean QueryPbufferEXT(IntPtr hPbuffer, int iAttribute, [Out] int* piValue);
-            internal unsafe static QueryPbufferEXT wglQueryPbufferEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate Boolean GetPixelFormatAttribivEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues);
-            internal unsafe static GetPixelFormatAttribivEXT wglGetPixelFormatAttribivEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate Boolean GetPixelFormatAttribfvEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues);
-            internal unsafe static GetPixelFormatAttribfvEXT wglGetPixelFormatAttribfvEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
-            internal unsafe delegate Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
-            internal unsafe static ChoosePixelFormatEXT wglChoosePixelFormatEXT;
-            [System.Security.SuppressUnmanagedCodeSecurity()]
             internal delegate Boolean SwapIntervalEXT(int interval);
             internal static SwapIntervalEXT wglSwapIntervalEXT;
             [System.Security.SuppressUnmanagedCodeSecurity()]
index 46231acacb03aabeaf568ef580965c438b0e17ce..fd1c3dee32d5a548dd1d11f00cce5b87389b0a51 100644 (file)
@@ -22,7 +22,6 @@ namespace OpenTK.Platform.Windows
             assembly = Assembly.GetExecutingAssembly();
             wglClass = assembly.GetType("OpenTK.Platform.Windows.Wgl");
             delegatesClass = wglClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
-            importsClass = wglClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
 
             //// Ensure core entry points are ready prior to accessing any method.
             //// Resolves bug [#993]: "Possible bug in GraphicsContext.CreateDummyContext()" 
@@ -38,7 +37,6 @@ namespace OpenTK.Platform.Windows
         private static Assembly assembly;
         private static Type wglClass;
         private static Type delegatesClass;
-        private static Type importsClass;
 
         private static bool rebuildExtensionList = true;
 
@@ -59,16 +57,7 @@ namespace OpenTK.Platform.Windows
         /// </returns>
         static Delegate LoadDelegate(string name, Type signature)
         {
-            Delegate d;
-            string realName = name.StartsWith("wgl") ? name.Substring(3) : name;
-
-            if (importsClass.GetMethod(realName,
-                BindingFlags.NonPublic | BindingFlags.Static) != null)
-                d = GetExtensionDelegate(name, signature) ??
-                    Delegate.CreateDelegate(signature, typeof(Imports), realName);
-            else
-                d = GetExtensionDelegate(name, signature);
-
+            Delegate d = GetExtensionDelegate(name, signature);
             return d;
         }
 
@@ -87,7 +76,7 @@ namespace OpenTK.Platform.Windows
         /// </returns>
         private static Delegate GetExtensionDelegate(string name, Type signature)
         {
-            IntPtr address = Imports.GetProcAddress(name);
+            IntPtr address = GetProcAddress(name);
 
             if (address == IntPtr.Zero ||
                 address == new IntPtr(1) ||     // Workaround for buggy nvidia drivers which return
index 860f4cad69d831823b84791d50cc0e162e6d81a8..e431ae6bafcfc9d31ea43836ceeb88039f01d0f8 100644 (file)
@@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
                     SetGraphicsModePFD(selector, GraphicsMode.Default, window);
 
                     // Then, construct a temporary context and load all wgl extensions
-                    ContextHandle temp_context = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
+                    ContextHandle temp_context = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
                     if (temp_context != ContextHandle.Zero)
                     {
                                                // Make the context current.
@@ -79,7 +79,7 @@ namespace OpenTK.Platform.Windows
                                                // Sigh...
                                                for (int retry = 0; retry < 5; retry++)
                                                {
-                                                       bool success = Wgl.Imports.MakeCurrent(window.DeviceContext, temp_context.Handle);
+                                                       bool success = Wgl.MakeCurrent(window.DeviceContext, temp_context.Handle);
                                                        if (!success)
                                                        {
                                                                Debug.Print("wglMakeCurrent failed with error: {0}. Retrying", Marshal.GetLastWin32Error());
@@ -94,8 +94,8 @@ namespace OpenTK.Platform.Windows
 
                                                // Load wgl extensions and destroy temporary context
                                                Wgl.LoadAll();
-                        Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
-                        Wgl.Imports.DeleteContext(temp_context.Handle);
+                        Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
+                        Wgl.DeleteContext(temp_context.Handle);
                     }
                     else
                     {
@@ -168,9 +168,9 @@ namespace OpenTK.Platform.Windows
                 {
                     // Failed to create GL3-level context, fall back to GL2.
                     Debug.Write("Falling back to GL2... ");
-                    Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
+                    Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
                     if (Handle == ContextHandle.Zero)
-                        Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
+                        Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
                     if (Handle == ContextHandle.Zero)
                         throw new GraphicsContextException(
                             String.Format("Context creation failed. Wgl.CreateContext() error: {0}.",
@@ -193,7 +193,7 @@ namespace OpenTK.Platform.Windows
                 {
                     Marshal.GetLastWin32Error();
                     Debug.Write(String.Format("Sharing state with context {0}: ", sharedContext));
-                    bool result = Wgl.Imports.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
+                    bool result = Wgl.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
                     Debug.WriteLine(result ? "success!" : "failed with win32 error " + Marshal.GetLastWin32Error());
                 }
             }
@@ -255,11 +255,11 @@ namespace OpenTK.Platform.Windows
                     if (wnd.Handle == IntPtr.Zero)
                         throw new ArgumentException("window", "Must point to a valid window.");
 
-                    success = Wgl.Imports.MakeCurrent(wnd.DeviceContext, Handle.Handle);
+                    success = Wgl.MakeCurrent(wnd.DeviceContext, Handle.Handle);
                 }
                 else
                 {
-                    success = Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
+                    success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
                 }
 
                 if (!success)
@@ -274,7 +274,7 @@ namespace OpenTK.Platform.Windows
 
         public override bool IsCurrent
         {
-            get { return Wgl.Imports.GetCurrentContext() == Handle.Handle; }
+            get { return Wgl.GetCurrentContext() == Handle.Handle; }
         }
 
         #endregion
@@ -338,7 +338,17 @@ namespace OpenTK.Platform.Windows
 
         public override IntPtr GetAddress(string function_string)
         {
-            IntPtr address = Wgl.Imports.GetProcAddress(function_string);
+            IntPtr address = Wgl.GetProcAddress(function_string);
+            if (!IsValid(address))
+            {
+                address = Functions.GetProcAddress(opengl32Handle, function_string);
+            }
+            return address;
+        }
+
+        public override IntPtr GetAddress(IntPtr function_string)
+        {
+            IntPtr address = Wgl.GetProcAddress(function_string);
             if (!IsValid(address))
             {
                 address = Functions.GetProcAddress(opengl32Handle, function_string);
@@ -403,7 +413,7 @@ namespace OpenTK.Platform.Windows
         {
             get
             {
-                return Wgl.Imports.GetCurrentDC();
+                return Wgl.GetCurrentDC();
             }
         }
 
@@ -462,7 +472,7 @@ namespace OpenTK.Platform.Windows
                 try
                 {
                     // This will fail if the user calls Dispose() on thread X when the context is current on thread Y.
-                    if (!Wgl.Imports.DeleteContext(Handle.Handle))
+                    if (!Wgl.DeleteContext(Handle.Handle))
                         Debug.Print("Failed to destroy OpenGL context {0}. Error: {1}",
                             Handle.ToString(), Marshal.GetLastWin32Error());
                 }
index 57b801bc2af3c169c85ab3f579e3a0fe338b7d73..67f3ce19f933f7e2d16954cbdce2b2e27bdfd71c 100644 (file)
@@ -109,15 +109,9 @@ namespace OpenTK.Platform.Windows
 
         static int DescribePixelFormat(IntPtr hdc, int ipfd, int cjpfd, ref PixelFormatDescriptor pfd)
         {
-            unsafe
-            {
-                fixed (PixelFormatDescriptor* ppfd = &pfd)
-                {
-                    // Note: DescribePixelFormat found in gdi32 is extremely slow
-                    // on nvidia, for some reason.
-                    return Wgl.Imports.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, ppfd);
-                }
-            }
+            // Note: DescribePixelFormat found in gdi32 is extremely slow
+            // on nvidia, for some reason.
+            return Wgl.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, out pfd);
         }
 
         #endregion