We can use DllImports for OpenGL functions <= v1.1 on all platforms,
including Windows. This allows us to reduce the number of required
GetProcAddress calls by 474, reducing startup time and memory
consumption.
This setting can be turned off through Settings.Legacy.UseDllImports
and UseWindowsCompatibleGL.
CSharpSpecWriter now correctly outputs doc summaries on ARB_imaging
functions that do not have a version/deprecation string. Additionally,
it no longer warns about documentation parameter mismatches for
parameters matching C# keywords.
Instead of using xslt, we now process the documentation in code. This
allows us to fix mismatches from e.g. invalid parameter names that
sometimes creep in the specs.
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.)
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.
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.
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.
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.
Scan through the list of wrappers once, instead of multiple times, in
order to find out which functions use which enums. This speeds up enum
generation tremendously.
These are convenience parameters for function receiving a size and an
array parameter, like DeleteTextures(int n, int[] ids). The generator
will now add overloads taking a single parameter, such as
DeleteTexture(int id).
Functions returning a value or array via an 'out' parameter will now get a convenience overload that returns the result via a return statement. In the case of arrays, only single-valued arrays will be supported. For example:
void GetIntegerv(enum pname, out int value)
will be get an overload of
int GetIntegerv(enum pname)
This will reduce the amount of helper overloads that must be maintained manually in GLHelpers.cs.
We should only generate delegates for actual OpenGL entry points, not
for overloaded functions that resolve to the same entry point. This
improves loading speeds and reduces the size of the compiled dll.
It is now possible to define multiple overloads of the same function,
each with different parameters. This is extremely useful for
maintaining backwards compatibility in the face of the changes between
GL 4.3 and 4.4.
ISpecWriter implementations must now store explicit references to a
Settings object. Additionally, all code generation is now handled inside
the ISpecWriter implementation (it used to be scattered over all Type,
Parameter, etc classes resulting in unmaintainable spaghetti code.)
Improved ISpecWriter API by removing low-level implementation details.
Made Constant implement IComparable so it can be sorted before being written to output.