Commit graph

394 commits

Author SHA1 Message Date
thefiddler
02bf55ad7e [ES] Fixed loading of OpenGL ES core API
eglGetProcAddress cannot be used to retrieve
entry points of core functions. Instead, we
use [DllImport] for core functions and function
pointers for extension functions.

Squashed commit of the following:

commit 0b84aa6ef78dfa3600b81fc412eb192f2a87e40c
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 02:24:58 2014 +0100

    [Examples] Rolled back changes to Example browser

commit 1acfbaac3d17184debdbbe872c58ac07d1b37c0a
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 02:20:57 2014 +0100

    [Examples] Rolled back WinForms example

commit 835d9d6035a890bd3426566929fbfd25c493eca0
Author: thefiddler <stapostol@gmail.com>
Date:   Sat Mar 15 01:15:01 2014 +0100

    [Examples] Rolled back erroneous GLControl mods

commit 056418014f0e835e83fb85b54b8749519a555364
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 23:11:11 2014 +0100

    [Rewrite] Remove calli prototypes

    When a function is called indirectly via a function pointer, its
    prototype is not required (the prototype is added as a callsite at the
    calli invocation.) Removing these prototypes reduces binary size by
    roughly 400KB.

commit 353a16ec2836c597150d2fab28581e7c264b2b39
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:31:25 2014 +0100

    [Rewrite] Call DllImports directly

    When a function does not have an allocated slot (i.e. slot = -1), then
    we will call its DllImport signature directly.

commit 9a5313e4b7afb10b698d255e4b5637887bf71cf3
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:30:04 2014 +0100

    [Bind] Do not allocate slots for DllImports

commit 6ac5342409363cac0e59f9dc669948b319bd20a9
Author: thefiddler <stapostol@gmail.com>
Date:   Fri Mar 14 22:29:07 2014 +0100

    [Bind] Added option to use DllImports

    This is necessary for the core functionality of OpenGL ES, where
    eglGetProcAddress returns null or garbage (the latter on Android.)
2014-03-16 19:40:49 +01:00
thefiddler
242b8bbe6c [Graphics] Init OpenTK when creating external context
Fixes issue #52
2014-03-13 19:51:29 +01:00
thefiddler
625ba5dcda [Graphics] Regenerated with newest generator 2014-03-13 19:44:33 +01:00
thefiddler
d12bd18158 Merge branch 'gl_Mar2014' into develop 2014-03-13 19:39:37 +01:00
thefiddler
51c173e935 [Graphics] Documented parameter length
Fixes issue #15
2014-03-13 19:38:12 +01:00
thefiddler
b3fac68b37 [Graphics] Synced with Khronos repository
Adds:
- INTEL_performance_query extension
- “count” attribute fixes for multiple functions
2014-03-13 18:46:01 +01:00
thefiddler
cf728a631e [Bind] Added overloads for backwards compatibility 2014-03-13 18:42:37 +01:00
Fraser Waters
95bd094404 Disable Obsolete warning.
IGraphicsContext.VSync property is obsolete, but we have to call it in
the GraphicsContext.VSync implementation, so disable the obsolete
warning for this one use.
2014-02-25 10:31:17 +00:00
Fraser Waters
b89f79266b Fix XML documentation. 2014-02-25 10:31:17 +00:00
thefiddler
63dd4597c7 [GL][ES] Mark DebugProc* delegates as unmanaged function pointers
Calling convention is platform-dependent: stdcall on Windows, cdecl
elsewhere. This maps to CallingConvention.Winapi in .Net parlance.
2014-02-06 15:01:22 +01:00
thefiddler
d8eda71a2c [GL] Added missing ActiveUniformType.FloatMat3x2 token 2014-02-04 14:26:52 +01:00
thefiddler
6f3951e825 [OpenTK] Allow a GraphicsMode.Buffers value of 0
0 in this case means “don’t care”.
2014-01-22 10:48:40 +01:00
thefiddler
ff36f0f35a [OpenTK] Clamp max AA level to 64x
This protects against a potential denial-of-service issue during mode
selection, where the platform backend will try to reduce AA level until
a supported mode is found.
2014-01-22 10:35:08 +01:00
thefiddler
2b6aec3b23 [OpenTK] Removed unused GraphicsMode field 2014-01-22 10:31:01 +01:00
thefiddler
514390fc9a [Graphics] Added missing documentation comment 2014-01-03 02:18:28 +01:00
thefiddler
04e6d9335a [Graphics] Improved support for external OpenGL contexts
When combining OpenTK with a third-party OpenGL toolkit, it is now
possible to implement a suitable GetAddress() and GetCurrentContext()
implementation in terms of the third-party toolkit. If no
implementation is specified, then OpenTK will try to guess the most
suitable implementation within its own platform backends.

If no custom implementation is defined, and if no suitable
implementation can be found, then OpenTK will throw a
PlatformNotSupportedException. If a suitable implementation is found or
defined, then OpenTK will attempt to load OpenGL entry points using
that implementation.

In this case third-party toolkit remains solely responsible for
managing its context via its MakeCurrent(), SwapBuffers(), etc
implementations.
2013-12-28 01:14:59 +01:00
Stefanos A.
f4360beb74 Use 16bit depth in GraphicsMode.Default
16bits appear to be better supported than 24bits on virtual machines.
2013-12-16 10:44:37 +01:00
Stefanos A.
3c6682e080 GraphicsContext cannot be released by finalizer
On many/most platforms, GraphicsContexts can only be released by the
thread where they are current. This means that the user must call
GraphicsContext.Dispose() or risk a resource leak.

Since we cannot release contexts on the finalizer thread, we should keep
strong references, instead of weak references, until the user explicitly
calls Dispose().

This patch fixes issues with SDL2 crashing when running the MonoGame
WindowsGL test suite.
2013-12-16 10:43:56 +01:00
Stefanos A
39a216f1ac Added overloads for compatibility with svn r3127
Several projects are still using the last svn revision from the
sourceforge repository (r3127). These overloads provide an upgrade path
from r3127 to OpenTK 1.1.
2013-12-16 01:55:05 +01:00
Stefanos A
78acd27c4c Updated OpenGL documentation to Khronos r24522 2013-12-15 22:32:32 +01:00
Stefanos A
14d815dc8b Fixed deprecation warning 2013-12-15 22:02:32 +01:00
Stefanos A
aeb7a72d79 Eliminated CLS-compliance warnings in the bindings 2013-12-15 22:01:45 +01:00
parallels
b31e0e8474 Compatibility fixes for Mono 2.10
The Mono 2.10 compiler fails when compiling extern methods that are not
marked as DllImport. We fix that by adding a method body that throws a
NotImplementedException instead.

Additionally, MonoDevelop 2.8 cannot open sln files with ToolsVersion 12.
The fix is to change ToolsVersion to 11.
2013-12-15 18:27:24 +01:00
Stefanos A
d0e52f6de7 Maintain backwards compatibility with 1.1 2013-12-15 16:58:33 +01:00
Stefanos A
dfd683ef49 Merge master into no-reflect 2013-12-15 16:36:37 +01:00
Stefanos A
5b48564ec2 Ignore missing comments warning
The OpenGL manpages do not include extension methods. Ignore this
warning to let more important ones shine through.
2013-12-06 19:33:03 +01:00
Stefanos A
1d26917758 Updated license information 2013-12-06 09:23:56 +01:00
Stefanos A
f1e93005b9 Added methods for 1.0 compatibility 2013-12-06 09:23:43 +01:00
Stefanos A
e59405dab3 Implemented manual marshaling of string parameters 2013-12-04 22:32:56 +01:00
Stefanos A
e2801c8c6c Convert string[] callsites to IntPtr
This fixes the signature mismatch between the new marshaling code and
the callsites.
2013-12-04 21:22:33 +01:00
Stefanos A
406de0b846 Regenerated bindings 2013-12-03 09:10:45 +01:00
Stefanos A
438f83c8d9 Mark slots with [DllImport]; remove "core" and "delegates" generation
We should be able to use static pinvokes on platforms that do not
provide or require extensions and calli instructions on platforms with
extension APIs. This dinstiction will be implemented as a parameter in
the rewriter.
2013-12-01 21:17:15 +01:00
Stefanos A
d6bf7c0d78 Regenerated bindings 2013-12-01 18:28:25 +01:00
Stefanos A.
c53c0bc66f Added GetProcAddress(IntPtr) overloads
This might allow us to improve startup performance, by avoiding string
marshaling during extension loading.
2013-11-28 23:21:19 +01:00
Stefanos A.
c369bfc75e Use [AutoGenerated] only for generated methods
The rewriter will patch the body of methods marked with [AutoGenerated].
Methods that are implemented manually (e.g. various math helper
overloads) should avoid this attribute.
2013-11-27 08:27:52 +01:00
Stefanos A
da4de365e8 Regenerated bindings 2013-11-27 00:03:21 +01:00
Stefanos A
40f992b5bd Rewrite support for [Slot] attribute 2013-11-26 01:31:10 +01:00
Stefanos A.
74159da199 Regenerated bindings 2013-11-25 00:19:18 +01:00
Stefanos A.
1e6a819b07 Removed GLObsolete.cs helper
This file must be recreated using the new loading mechanism.
2013-11-24 13:59:15 +01:00
Stefanos A.
811b04e880 Regenerated bindings with new loading mechanism 2013-11-24 13:58:54 +01:00
Stefanos A.
fec958c8dc Hooked up new loading mechanism 2013-11-24 13:58:30 +01:00
Stefanos A.
825ed3621f Implemented new loading mechanism 2013-11-24 13:57:43 +01:00
Stefanos A.
7a57c9c3d2 Clarified GetAddress documentation 2013-11-24 13:57:23 +01:00
Stefanos A.
1e71ca9122 Removed delegates and DllImports 2013-11-24 13:56:35 +01:00
Stefanos A
8ee2152709 Moved delegate loaders to the Delegates class 2013-11-23 17:23:26 +01:00
Stefanos A
03a26ed12f Regenerated bindings with lazy loading 2013-11-22 20:07:01 +01:00
Stefanos A
ffe934fa5d Added static GetExtensionDelegate implementation 2013-11-22 20:06:04 +01:00
Stefanos A
2ace001203 Implemented direct binding loading
OpenTK normally uses reflection to load bindings, instead of generating
huge constructors. Although reflection is faster on first load (thanks
to reduced JIT overhead), it fails to work correctly with monolinker.
This branch explores the performance of a direct binding.
2013-11-22 17:32:17 +01:00
Stefanos A.
b7af883cff Fix exceptions on reused OpenGL context handles
Implementations may reuse OpenGL context handles that have been
destroyed. If a context is finalized but not Disposed, then OpenTK may
keep a reference to the old context handle, causing a crash when the
same handle is returned for a new context. To fix that, new context
handles will now replace old handles in case of a clash.
2013-11-21 09:34:06 +01:00
Stefanos A
255f4e9083 Completed compatibility overloads for OpenTK 1.0 2013-11-20 08:16:07 +01:00