platform/core/csapi/opentk.git
11 years agoMerge remote-tracking branch 'origin/master' into no-reflect
Stefanos A [Thu, 5 Dec 2013 13:53:37 +0000 (14:53 +0100)]
Merge remote-tracking branch 'origin/master' into no-reflect

11 years agoMove installer to destination directory 1.1-b2
Stefanos A. [Thu, 5 Dec 2013 11:05:26 +0000 (12:05 +0100)]
Move installer to destination directory

This reduces the garbage left behind by the installer generation script.

11 years agoStreamlined nsis installer
Stefanos A. [Thu, 5 Dec 2013 11:04:58 +0000 (12:04 +0100)]
Streamlined nsis installer

OpenAL is now included in the Dependencies/ folder and NShader is no
longer linked to by the installer.

11 years agoIgnore generated installers
Stefanos A. [Thu, 5 Dec 2013 11:04:15 +0000 (12:04 +0100)]
Ignore generated installers

11 years agoCorrected zip build script
Stefanos A. [Thu, 5 Dec 2013 10:42:01 +0000 (11:42 +0100)]
Corrected zip build script

Excluded items are now really excluded.

11 years agoReduce temporary string allocations
Stefanos A [Thu, 5 Dec 2013 10:20:58 +0000 (11:20 +0100)]
Reduce temporary string allocations

Instead of modifying the name of an OpenGL symbol on the managed side,
before copying it to the unmanaged side, we perform the modification
directly on the unmanaged side. This reduces the total amount of
allocations in OpenTK by ~30% (673496 bytes in 10750 objects compared
to 930272 bytes in 15243 objects before this modification.)

11 years agoAdded debug arguments in release builds
Stefanos A [Thu, 5 Dec 2013 08:14:13 +0000 (09:14 +0100)]
Added debug arguments in release builds

11 years agoGenerate debug symbols in release builds
Stefanos A [Thu, 5 Dec 2013 08:13:50 +0000 (09:13 +0100)]
Generate debug symbols in release builds

11 years agoUpdated project files
Stefanos A. [Thu, 5 Dec 2013 08:03:12 +0000 (09:03 +0100)]
Updated project files

Generate debug symbols on release builds. Remove unused resx file that
referenced WinForms.

11 years agoImplemented manual marshaling of string parameters
Stefanos A [Wed, 4 Dec 2013 21:32:56 +0000 (22:32 +0100)]
Implemented manual marshaling of string parameters

11 years agoCorrect convenience wrapper implementation
Stefanos A [Wed, 4 Dec 2013 21:26:30 +0000 (22:26 +0100)]
Correct convenience wrapper implementation

11 years agoConvert string[] callsites to IntPtr
Stefanos A [Wed, 4 Dec 2013 20:22:33 +0000 (21:22 +0100)]
Convert string[] callsites to IntPtr

This fixes the signature mismatch between the new marshaling code and
the callsites.

11 years agoImplemented marshaling for string arrays
Stefanos A [Wed, 4 Dec 2013 19:33:19 +0000 (20:33 +0100)]
Implemented marshaling for string arrays

This allows functions such as GL.ShaderSource to run on Mono without
crashing.

11 years agoRegenerated bindings
Stefanos A [Tue, 3 Dec 2013 08:10:45 +0000 (09:10 +0100)]
Regenerated bindings

11 years agoClean up wrapper generation
Stefanos A [Tue, 3 Dec 2013 08:10:36 +0000 (09:10 +0100)]
Clean up wrapper generation

We can now apply multiple WrapperTypes values to a single parameter.

11 years agoUpdate WrapperTypes values for [Flags]
Stefanos A [Tue, 3 Dec 2013 08:09:19 +0000 (09:09 +0100)]
Update WrapperTypes values for [Flags]

11 years agoRemoved duplicate ldarg
Stefanos A [Tue, 3 Dec 2013 07:59:48 +0000 (08:59 +0100)]
Removed duplicate ldarg

11 years agoWorkaround for #5
Stefanos A. [Mon, 2 Dec 2013 22:39:36 +0000 (23:39 +0100)]
Workaround for #5

WS_CLIPCHILDREN and WS_CLIPSIBLINGS appear to cause flickering on
specific video cards. OpenGL appears to work correctly without these, so
we'll disable them to return to OpenTK 1.0 behavior.

11 years agoFixed centering for non DPI-aware applications
Stefanos A. [Mon, 2 Dec 2013 22:37:22 +0000 (23:37 +0100)]
Fixed centering for non DPI-aware applications

11 years agoDPI-scaling should affect resolution
Stefanos A. [Mon, 2 Dec 2013 22:37:00 +0000 (23:37 +0100)]
DPI-scaling should affect resolution

The correct resolution will now be reported depending on whether the
application is DPI-aware.

11 years agoHigh-resolution mode is enabled by default
Stefanos A. [Mon, 2 Dec 2013 21:34:39 +0000 (22:34 +0100)]
High-resolution mode is enabled by default

11 years agoMade DPI-awareness configurable (issue #6)
Stefanos A. [Mon, 2 Dec 2013 21:18:16 +0000 (22:18 +0100)]
Made DPI-awareness configurable (issue #6)

It is now possible to indicate that an application is not DPI-aware. In
that case, OpenTK will let the operating system handle DPI scaling. This
results in worse visuals (pixel doubling) but allows non DPI-aware
applications to continue working.

11 years agoRemoved unused code
Stefanos A [Mon, 2 Dec 2013 15:30:14 +0000 (16:30 +0100)]
Removed unused code

11 years agoAdded MonoDevelop project policy
Stefanos A [Mon, 2 Dec 2013 11:00:11 +0000 (12:00 +0100)]
Added MonoDevelop project policy

11 years agoInitial implementation of manual StringBuilder marshaling (WIP)
Stefanos A [Mon, 2 Dec 2013 10:59:40 +0000 (11:59 +0100)]
Initial implementation of manual StringBuilder marshaling (WIP)

The implementation is based on Marshal.AllocHGlobal and
Marshal.FreeHGlobal. This is not working correctly yet.

11 years agoAdded manual marshaling for StringBuilder
Stefanos A [Mon, 2 Dec 2013 10:58:41 +0000 (11:58 +0100)]
Added manual marshaling for StringBuilder

Mono fails to marshal StringBuilder arguments in unmanaged callsites
invoked through calli. We need to implement the marshaling code
ourselves.

11 years agoUse StdCall calling convention by default
Stefanos A [Sun, 1 Dec 2013 20:25:03 +0000 (21:25 +0100)]
Use StdCall calling convention by default

It appears that calli callsites cannot be decorated with the
“platformapi” calling convention like DllImport signatures can. This is
problematic since Windows uses stdcall by default and most other
platforms use cdecl.

There are three approaches to this issue, without going back to
delegate calls: (a) generate an unmanaged thunk that cleans up the
stack after a GL call; (b) use libFFI; (c) use cdecl *or* stdcall
everywhere and hope that the runtime can cope.

.Net 2.0 can detect and fix stdcall functions invoked through a cdecl
callsite. .Net 4.0 adds a configuration option to enable or disable
this fixup (faster p/invoke if disabled) and raise a MDA exception when
this condition is detected. (This affects x86 only.)

Mono appears to be able to cope with cdecl functions invoked through a
stdcall callsite.

More testing is required.

11 years agoMark slots with [DllImport]; remove "core" and "delegates" generation
Stefanos A [Sun, 1 Dec 2013 20:17:15 +0000 (21:17 +0100)]
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.

11 years agoRegenerated bindings
Stefanos A [Sun, 1 Dec 2013 17:28:25 +0000 (18:28 +0100)]
Regenerated bindings

11 years agoEnabled symbol generation; minor code cleanup
Stefanos A [Sun, 1 Dec 2013 17:28:11 +0000 (18:28 +0100)]
Enabled symbol generation; minor code cleanup

11 years agoUse untyped int for enums in unmanaged callsites
Stefanos A [Sun, 1 Dec 2013 17:26:01 +0000 (18:26 +0100)]
Use untyped int for enums in unmanaged callsites

By using untyped integers instead of typed integers in the unmanaged
callsites, we allow monolinker to keep the exact set of enums that are
used by the user. Without this, we’d have to keep every single enum in
place to avoid missing type exceptions.

This does not affect the public signatures or the generated code in any
way.

11 years agoLoad system types from referenced mscorlib
Stefanos A [Sat, 30 Nov 2013 01:32:10 +0000 (02:32 +0100)]
Load system types from referenced mscorlib

11 years agoUse C calling convention even on Windows
Stefanos A. [Sat, 30 Nov 2013 01:16:34 +0000 (02:16 +0100)]
Use C calling convention even on Windows

11 years agoCorrected the handling of arrays
Stefanos A. [Sat, 30 Nov 2013 01:00:07 +0000 (02:00 +0100)]
Corrected the handling of arrays

This includes arrays of primitives and arrays of generics. Our code is
similar to the code generated by the Mono C# compiler for the "fixed"
construct. The .Net compiler produces slightly different code (two local
variables instead of one) - more research is required.

11 years agoRefactored il emitters into methods
Stefanos A. [Fri, 29 Nov 2013 18:24:38 +0000 (19:24 +0100)]
Refactored il emitters into methods

11 years agoUse unmanaged StdCall calling convention
Stefanos A. [Fri, 29 Nov 2013 18:11:52 +0000 (19:11 +0100)]
Use unmanaged StdCall calling convention

Default results in a managed calling convention which does not generate
unmanaged thunking code for parameter marshaling.
System.Runtime.InteropServices.CallingConvention.Winapi appears to
correspond to StdCall for calli callsites (this might be different for
pinvoke, which supports an unmanaged "platformapi" calling convention.)
Needs more testing to prove this is doing the right thing on non-Windows
platforms.

11 years agoRemoved deleted file from project
Stefanos A. [Thu, 28 Nov 2013 22:23:03 +0000 (23:23 +0100)]
Removed deleted file from project

11 years agoRemoved unused WGL methods
Stefanos A. [Thu, 28 Nov 2013 22:22:35 +0000 (23:22 +0100)]
Removed unused WGL methods

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.

11 years agoAdded GetProcAddress(IntPtr) overloads
Stefanos A. [Thu, 28 Nov 2013 22:21:19 +0000 (23:21 +0100)]
Added GetProcAddress(IntPtr) overloads

This might allow us to improve startup performance, by avoiding string
marshaling during extension loading.

11 years agoFixed wglGetProcAddress entry point
Stefanos A. [Thu, 28 Nov 2013 08:04:08 +0000 (09:04 +0100)]
Fixed wglGetProcAddress entry point

A typo would cause extension loading to fail. This is now fixed.

11 years agoRemoved unused WGL bindings
Stefanos A. [Wed, 27 Nov 2013 18:37:59 +0000 (19:37 +0100)]
Removed unused WGL bindings

Our WGL bindings contained dozens of methods that OpenTK did not use.
Removing these reduces the dll size and improves startup times.

11 years agoFixed entry point validity check
Stefanos A. [Wed, 27 Nov 2013 18:36:42 +0000 (19:36 +0100)]
Fixed entry point validity check

11 years agoEnable InitLocals to make peverify happy
Stefanos A. [Wed, 27 Nov 2013 08:16:23 +0000 (09:16 +0100)]
Enable InitLocals to make peverify happy

11 years agoFixed convenience return type implementation
Stefanos A. [Wed, 27 Nov 2013 08:09:33 +0000 (09:09 +0100)]
Fixed convenience return type implementation

11 years agoCorrected RewrittenAttribute definition
Stefanos A. [Wed, 27 Nov 2013 07:45:28 +0000 (08:45 +0100)]
Corrected RewrittenAttribute definition

11 years agoBuild 3.5 profile with Visual Studio
Stefanos A. [Wed, 27 Nov 2013 07:28:39 +0000 (08:28 +0100)]
Build 3.5 profile with Visual Studio

11 years agoRewrite nested types
Stefanos A. [Wed, 27 Nov 2013 07:28:22 +0000 (08:28 +0100)]
Rewrite nested types

Fixes zero-RVA exception for OpenGL extensions (e.g. GL.Ext etc)

11 years agoUse [AutoGenerated] only for generated methods
Stefanos A. [Wed, 27 Nov 2013 07:27:52 +0000 (08:27 +0100)]
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.

11 years agoImplemented string return types
Stefanos A [Wed, 27 Nov 2013 00:40:12 +0000 (01:40 +0100)]
Implemented string return types

11 years agoAdded MonoDevelop artifacts
Stefanos A [Tue, 26 Nov 2013 23:05:26 +0000 (00:05 +0100)]
Added MonoDevelop artifacts

11 years agoRegenerated bindings
Stefanos A [Tue, 26 Nov 2013 23:03:21 +0000 (00:03 +0100)]
Regenerated bindings

11 years agoImplemented convenience wrapper types
Stefanos A [Tue, 26 Nov 2013 23:03:03 +0000 (00:03 +0100)]
Implemented convenience wrapper types

11 years agoEmit native signatures
Stefanos A [Tue, 26 Nov 2013 23:02:26 +0000 (00:02 +0100)]
Emit native signatures

The patcher uses those signatures to implement wrapper functionality
for the various wrapper types that exist in OpenTK.

11 years agoUpdate to latest version from git
Stefanos A [Tue, 26 Nov 2013 18:07:01 +0000 (19:07 +0100)]
Update to latest version from git

11 years agoProtect against multiple runs; optimize il
Stefanos A [Tue, 26 Nov 2013 18:06:39 +0000 (19:06 +0100)]
Protect against multiple runs; optimize il

11 years agoDo not emit method bodies.
Stefanos A [Tue, 26 Nov 2013 00:31:29 +0000 (01:31 +0100)]
Do not emit method bodies.

11 years agoRewrite support for [Slot] attribute
Stefanos A [Tue, 26 Nov 2013 00:31:10 +0000 (01:31 +0100)]
Rewrite support for [Slot] attribute

11 years agoInitial work on Pin<> statements (WIP)
Stefanos A. [Mon, 25 Nov 2013 19:00:22 +0000 (20:00 +0100)]
Initial work on Pin<> statements (WIP)

11 years agoFixed build on Visual Studio
Stefanos A. [Mon, 25 Nov 2013 09:06:10 +0000 (10:06 +0100)]
Fixed build on Visual Studio

11 years agoApplied MonoDevelop project style
Stefanos A [Mon, 25 Nov 2013 07:54:15 +0000 (08:54 +0100)]
Applied MonoDevelop project style

11 years agoCorrected keyfile path
Stefanos A [Mon, 25 Nov 2013 07:53:44 +0000 (08:53 +0100)]
Corrected keyfile path

11 years agoCorrected patch for CallReturn<TRet, ...> signatures
Stefanos A [Mon, 25 Nov 2013 07:53:27 +0000 (08:53 +0100)]
Corrected patch for CallReturn<TRet, ...> signatures

.Net will happily execute a calli with a generic return type, whereas
Mono will refuse to. Mono is probably doing the right thing here. Fixed
by resolving the generic return into a concrete type.

11 years agoAdded rewrite postbuild event
Stefanos A. [Sun, 24 Nov 2013 23:58:39 +0000 (00:58 +0100)]
Added rewrite postbuild event

11 years agoFixed calling convention for non-Windows platforms
Stefanos A. [Sun, 24 Nov 2013 23:58:09 +0000 (00:58 +0100)]
Fixed calling convention for non-Windows platforms

11 years agoFixed core loading on Windows
Stefanos A. [Sun, 24 Nov 2013 23:26:20 +0000 (00:26 +0100)]
Fixed core loading on Windows

On Windows, entry points for OpenGL 1.0 and 1.1 are not exposed by
wglGetProcAddress. We fall back to LoadLibrary+GetProcAddress when
wglProcAddress fails.

11 years agoAdded OpenTK.Rewrite project
Stefanos A. [Sun, 24 Nov 2013 23:20:55 +0000 (00:20 +0100)]
Added OpenTK.Rewrite project

11 years agoAdded InteropHelper file
Stefanos A. [Sun, 24 Nov 2013 23:20:22 +0000 (00:20 +0100)]
Added InteropHelper file

11 years agoImplemented dll rewriter using Mono.Cecil
Stefanos A. [Sun, 24 Nov 2013 23:19:54 +0000 (00:19 +0100)]
Implemented dll rewriter using Mono.Cecil

11 years agoRegenerated bindings
Stefanos A. [Sun, 24 Nov 2013 23:19:18 +0000 (00:19 +0100)]
Regenerated bindings

11 years agoMoved address parameter to last place
Stefanos A. [Sun, 24 Nov 2013 23:18:43 +0000 (00:18 +0100)]
Moved address parameter to last place

This way, it is the last item on the evaluation stack before calling the
unmanaged function pointer. This simplifies the calli rewrite procedure.

11 years agoRemoved GLObsolete.cs helper
Stefanos A. [Sun, 24 Nov 2013 12:59:15 +0000 (13:59 +0100)]
Removed GLObsolete.cs helper

This file must be recreated using the new loading mechanism.

11 years agoRegenerated bindings with new loading mechanism
Stefanos A. [Sun, 24 Nov 2013 12:58:54 +0000 (13:58 +0100)]
Regenerated bindings with new loading mechanism

11 years agoHooked up new loading mechanism
Stefanos A. [Sun, 24 Nov 2013 12:58:30 +0000 (13:58 +0100)]
Hooked up new loading mechanism

11 years agoHooked up new loading mechanism
Stefanos A. [Sun, 24 Nov 2013 12:58:12 +0000 (13:58 +0100)]
Hooked up new loading mechanism

11 years agoImplemented new loading mechanism
Stefanos A. [Sun, 24 Nov 2013 12:57:43 +0000 (13:57 +0100)]
Implemented new loading mechanism

11 years agoClarified GetAddress documentation
Stefanos A. [Sun, 24 Nov 2013 12:57:23 +0000 (13:57 +0100)]
Clarified GetAddress documentation

11 years agoAllow overriding of loading methods
Stefanos A. [Sun, 24 Nov 2013 12:57:08 +0000 (13:57 +0100)]
Allow overriding of loading methods

11 years agoRemoved delegates and DllImports
Stefanos A. [Sun, 24 Nov 2013 12:56:35 +0000 (13:56 +0100)]
Removed delegates and DllImports

11 years agoAdd slots into entry point table
Stefanos A. [Sun, 24 Nov 2013 12:55:13 +0000 (13:55 +0100)]
Add slots into entry point table

11 years agoGenerate entry point tables
Stefanos A. [Sun, 24 Nov 2013 12:54:52 +0000 (13:54 +0100)]
Generate entry point tables

11 years agoMoved delegate loaders to the Delegates class
Stefanos A [Sat, 23 Nov 2013 16:23:26 +0000 (17:23 +0100)]
Moved delegate loaders to the Delegates class

11 years agoRegenerated bindings with lazy loading
Stefanos A [Fri, 22 Nov 2013 19:07:01 +0000 (20:07 +0100)]
Regenerated bindings with lazy loading

11 years agoAdded support for lazy binding loading
Stefanos A [Fri, 22 Nov 2013 19:06:49 +0000 (20:06 +0100)]
Added support for lazy binding loading

11 years agoMoved GetExtensionDelegate to the correct position
Stefanos A [Fri, 22 Nov 2013 19:06:28 +0000 (20:06 +0100)]
Moved GetExtensionDelegate to the correct position

11 years agoAdded static GetExtensionDelegate implementation
Stefanos A [Fri, 22 Nov 2013 19:06:04 +0000 (20:06 +0100)]
Added static GetExtensionDelegate implementation

11 years agoAdd test for new text input events
Stefanos A. [Fri, 22 Nov 2013 17:25:30 +0000 (18:25 +0100)]
Add test for new text input events

11 years agoImplemented KeyPress event for Sdl2NativeWindow.
Elias Holzer [Fri, 22 Nov 2013 17:05:11 +0000 (18:05 +0100)]
Implemented KeyPress event for Sdl2NativeWindow.

11 years agoImplemented KeyDown and KeyUp events for Sdl2NativeWindow.
Elias Holzer [Fri, 22 Nov 2013 17:04:53 +0000 (18:04 +0100)]
Implemented KeyDown and KeyUp events for Sdl2NativeWindow.

11 years agoEnabled KeyDown and KeyUp events in NativeWindow.
Elias Holzer [Fri, 22 Nov 2013 17:03:17 +0000 (18:03 +0100)]
Enabled KeyDown and KeyUp events in NativeWindow.

11 years agoImplemented direct binding loading
Stefanos A [Fri, 22 Nov 2013 16:32:17 +0000 (17:32 +0100)]
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.

11 years agoFix "CursorVisible bugs"
Stefanos A. [Fri, 22 Nov 2013 13:10:21 +0000 (14:10 +0100)]
Fix "CursorVisible bugs"

When we enter the modal resize loop on Windows with ClipCursor set, we
cause a feedback loop where every resize causes the cursor to move and
every move causes a new resize. To fix this, we need to ungrab the
cursor when we are enter the modal loop.

11 years agoUpdated release notes 1.1-b1
Stefanos A. [Thu, 21 Nov 2013 23:32:42 +0000 (00:32 +0100)]
Updated release notes

11 years agoUpdated todo list
Stefanos A. [Thu, 21 Nov 2013 18:44:12 +0000 (19:44 +0100)]
Updated todo list

11 years agoUpdated build instructions.
Stefanos A. [Thu, 21 Nov 2013 08:34:34 +0000 (09:34 +0100)]
Updated build instructions.

11 years agoFix exceptions on reused OpenGL context handles
Stefanos A. [Thu, 21 Nov 2013 08:34:06 +0000 (09:34 +0100)]
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.

11 years agoDestroy SDL window when finalized
Stefanos A. [Thu, 21 Nov 2013 08:31:32 +0000 (09:31 +0100)]
Destroy SDL window when finalized

SDL_DestroyWindow must be called on the main thread. If the window is
finalized, the finalizer will push a CLOSE event to the event loop
(thread-safe) and the window will be destroyed on the main thread.

11 years agoFixed #5
Stefanos A. [Wed, 20 Nov 2013 17:05:45 +0000 (18:05 +0100)]
Fixed #5

We need to release the cursor before closing a GameWindow, otherwise
subsequent GameWindows may fail to receive mouse events.

11 years agoToolkit.Init() now returns a concrete class
Stefanos A. [Wed, 20 Nov 2013 12:12:42 +0000 (13:12 +0100)]
Toolkit.Init() now returns a concrete class

This gives us room for expansion in the future, if necessary.

11 years agoRemoved incorrect comment
Stefanos A. [Wed, 20 Nov 2013 12:05:49 +0000 (13:05 +0100)]
Removed incorrect comment

11 years agoFixed #4
Stefanos A. [Wed, 20 Nov 2013 08:10:12 +0000 (09:10 +0100)]
Fixed #4

Sdl2InputDriver.Dispose() would call SDL_DelEventWatch with a different
"user_data" parameter than SDL_AdEventWatch. This caused the EventFilter
to remain registered and subsequently crash when closing and reopening a
window.