Commit graph

606 commits

Author SHA1 Message Date
Stefanos A
dfd683ef49 Merge master into no-reflect 2013-12-15 16:36:37 +01:00
Stefanos A.
a4f59f7384 Split binaries for library and supporting tools
Tools now go to the Binaries/Tools/[Debug|Release] directory. OpenTK
remains at BInaries/OpenTK/[Debug|Release].

Mono.Cecil and IKVM now reside under the Dependencies/managed/
directory.
2013-12-05 18:43:47 +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
4286b47d6f Clean up wrapper generation
We can now apply multiple WrapperTypes values to a single parameter.
2013-12-03 09:10:36 +01:00
Stefanos A
e178f306eb Update WrapperTypes values for [Flags] 2013-12-03 09:09:19 +01:00
Stefanos A
78c0c0d16e Removed unused code 2013-12-02 16:30:14 +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
2290e06cbd 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.
2013-12-01 18:26:01 +01:00
Stefanos A
ac65eb7b09 Added MonoDevelop artifacts 2013-11-27 00:05:26 +01:00
Stefanos A
82b0b477da Emit native signatures
The patcher uses those signatures to implement wrapper functionality
for the various wrapper types that exist in OpenTK.
2013-11-27 00:02:26 +01:00
Stefanos A
4149cdfa88 Do not emit method bodies. 2013-11-26 01:31:29 +01:00
Stefanos A.
84a1e5a739 Initial work on Pin<> statements (WIP) 2013-11-25 20:00:22 +01:00
Stefanos A.
c8e753d2da 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.
2013-11-25 00:18:43 +01:00
Stefanos A.
2045f3e98e Add slots into entry point table 2013-11-24 13:55:13 +01:00
Stefanos A.
7b93a87bb0 Generate entry point tables 2013-11-24 13:54:52 +01:00
Stefanos A
8ee2152709 Moved delegate loaders to the Delegates class 2013-11-23 17:23:26 +01:00
Stefanos A
0fea0a19b7 Added support for lazy binding loading 2013-11-22 20:06:49 +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
02120f429f Do not trim 's' from Groups 2013-11-20 08:16:06 +01:00
Stefanos A
635bb85313 Reverted 'h' suffix detection
This causes too many breaking changes in the NV namespace.
2013-11-18 18:32:36 +01:00
Stefanos A
ac0fab7760 More compatibility overloads for OpenGL 2013-11-18 18:32:36 +01:00
Stefanos A
5d4c42672f Improved suffix detection. Support index-based parameter overloading. 2013-11-18 18:32:34 +01:00
Stefanos A
3d50554903 Added OpenGL overloads for OpenTK-1.0 compatibility 2013-11-18 13:28:44 +01:00
Stefanos A
e572f418af Added compatibility overloads for ES 2.0 2013-11-18 01:10:01 +01:00
Stefanos A
0865b0f200 Allow overriding of function names 2013-11-17 23:56:51 +01:00
Stefanos A
fbcae3b2fe Removed debugging code 2013-11-17 21:27:22 +01:00
Stefanos A
b652145977 Handle overloads with different element counts 2013-11-17 21:27:09 +01:00
Stefanos A
c175a486fc Improved and documented IEquatable vs IComparable 2013-11-17 21:26:28 +01:00
Stefanos A
13d3bdb47f OpenGL overrides for compatibility
Added overrides to maintain backwards compatibility with
OpenTK.Graphics.OpenGL.GL. These were generated
through the apitest tool.
2013-11-17 01:49:07 +01:00
Stefanos A
f8a81f396e Cleaned up ending trim regex
Trim regex will now correctly match GetInteger64 and other functions
ending in "64". It also uses a correct ending anchor to avoid matches
in the middle of a function name.
2013-11-17 01:49:07 +01:00
Stefanos A
fd910e6a6c Added int/uint to the c# typemap 2013-11-17 01:49:07 +01:00
Stefanos A
afd076a83d Speed up enum code generator
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.
2013-11-17 01:49:07 +01:00
Stefanos A
f9deeaead7 Improved compatibility with OpenTK 1.0
Added overloads for enumerations with name changes. Reduced differences
between ES and GL APIs.
2013-11-15 01:59:50 +01:00
Stefanos A
cdd6259fee Removed debug leftovers 2013-11-14 23:38:17 +01:00
Stefanos A
431202d830 Corrected convenience wrappers for Get* and Delete*
GetBoolean, GetInteger6, GetFixedvOES and Delete* are now matched in
the convenience wrapper generator. Methods returning vectors of fixed
size (e.g. 4 ints) are no longer matched.
2013-11-14 17:40:06 +01:00
Stefanos A
2e14ca59b2 AMD_performance_monitors is not const-correct
Workaround fo  bug in rhe specification of AMD_performance_monitors.
Upstream bug report here:
https://www.khronos.org/bugzilla/show_bug.cgi?id=1035
2013-11-14 16:17:20 +01:00
Stefanos A
4fd6347de7 Mark untyped overloads as obsolete 2013-11-14 14:10:19 +01:00
Stefanos A
11070bb52a Added support for obsolete attribute
Functions marked with the obsolete attribute will now add [Obsolete] to
the generated output.
2013-11-14 13:46:42 +01:00
Stefanos A
5b4d3edf39 ES11 compatibility overloads (WIP1) 2013-11-14 11:34:46 +01:00
Stefanos A
c5591e9968 Clear qualifier path when changing type
This fixes a bug where overriding an enum parameter with a non-enum
parameter would result in the wrong qualifier path.
2013-11-14 11:33:52 +01:00
Stefanos A
ce7a7c7cf3 New Add() methods analogous to FunctionCollection 2013-11-14 11:32:25 +01:00
Stefanos A
5f7008d746 Improved override/overload lookup
The lookup for function overrides and overloads now tries to work
around extension case mismatches (e.g. IBM vs Ibm). This fixes a few
specific cases of missing overrides.
2013-11-14 11:31:36 +01:00
Stefanos A
d28c428e99 Correctly set generator mode. 2013-11-14 09:28:27 +01:00
Stefanos A.
4fd5cc30d5 Corrected option parsing 2013-11-13 14:29:06 +01:00
thefiddler
1792f7bf29 Added Version20 overload to StencilFuncSeparate
Compatibility fix for OpenTK 1.0
2013-11-12 23:39:43 +01:00
thefiddler
4f6c2ac2b4 Support multiple overloads
It is now possible to specify multiple overloads for the same function.
This is helpful for maintaining backwards compatibility with previous
releases.
2013-11-12 23:38:09 +01:00
thefiddler
8360b7a2ba Generate overloads without strong enums for 1.0 compat
OpenTK 1.0 and Xamarin Android/iOS do not use strongly-typed enums for
OpenGL ES. Generate overloads with the "All" enum in order to maintain
compatibility.
2013-11-11 10:03:24 +01:00
thefiddler
4d717dcdda Allow '+' and '-' cmdline options for compatibility settings 2013-11-11 10:02:08 +01:00
thefiddler
8e9a9355b0 Allow overriding of Settings.Compatibility 2013-11-11 10:01:30 +01:00
thefiddler
0fcf3a2f40 Minor code cleanup 2013-11-11 10:01:15 +01:00
thefiddler
af16be42d5 Corrected Parameter.IsEnum property 2013-11-11 10:00:54 +01:00
thefiddler
dde7c645c4 Removed unused code 2013-11-11 10:00:32 +01:00
Stefanos A.
d0e025b86d Restrict convenience overloads
Only Get*, Gen*, Delete* and New* functions get convenience overloads.
This avoids issues with functions such as Rect() that have similar
signatures but cannot use such overloads.

This restriction will be relaxed in the future.
2013-11-10 19:03:49 +01:00
Stefanos A.
293c020151 Added WrapperTypes.ConvenienceArrayType
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).
2013-11-10 18:29:53 +01:00
Stefanos A.
af7fdea449 Return types must be cls-compliant
CreateCLSCompliantWrappers must always change return types into
cls-compliant types. The reason is that we cannot overload on return
type alone, so we should always choose the compliant version.
2013-11-10 15:35:47 +01:00
Stefanos A.
6098fa05ce Plural name to singular in convenience overloads 2013-11-10 10:16:47 +01:00
Stefanos A.
11c1071625 Corrected declarations in convenience overloads 2013-11-10 10:08:04 +01:00
Stefanos A.
089c108ea0 Corrected indentation 2013-11-10 09:20:54 +01:00
Stefanos A.
c1cb70d215 Improve indentation for doc comments
Doc comments are now split at their source, as a first step in
normalizing their indentation between VS and MD.
2013-11-10 09:12:42 +01:00
thefiddler
d126d25215 Add helper overload generation
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.
2013-11-10 08:28:58 +01:00
thefiddler
0d73706c88 Added new WrapperTypes; removed unused code
New WrapperTypes for convenience functions: ConvenienceReturnType to
replace an "out" parameter by a return value, and
ConvenienceArrayReturnType to replace an out array parameter by a
single return value (array count of 1 only).
2013-11-09 19:24:43 +01:00
thefiddler
417aa67139 Implemented Add and AddRange methods
These supplant the static Utilities.Merge() overloads.
2013-11-09 19:22:31 +01:00
Stefanos A
49df5ff453 Do not generate delegates for overloads
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.
2013-11-08 16:40:43 +01:00
Stefanos A
7ab5e3ab6c Use paths without apiversion attribute
Paths that don't define a "version" attribute will now match all
possible versions. This will make it easier to add support for newer
APIs as they are introduced.
2013-11-07 16:48:11 +01:00
Stefanos A
1f6d445021 Removed non-existent token from OpenGL
COMPRESSED_ALPHA_BPTC_UNORM does not appear to be defined anywhere.
Removed.
2013-11-07 16:46:38 +01:00
Stefanos A
be8f7c6311 Corrected ES 2.0 enums
After the previous commit, several ES 2.0 functions would refer to
enums found in ES 3.0. These enums have been copied to ES 2.0, either
as core enums or as extensions.
2013-11-07 16:25:19 +01:00
Stefanos A
735d05e496 Merged ES2.0 and ES3.0 replacements
ES 3.0 includes ES 2.0 verbatim. We can significantly reduce
duplication by using the same <replace> node for both APIs. Note that
the enumerations must remain separate, as ES 2.0 and 3.0 support
different tokens.
2013-11-07 11:37:51 +01:00
Stefanos A
7c54a19708 ES 3.0 fixed enums for GetIntegeri_v and GetInteger64i_v
These functions have a first parameter named "target", not "pname".
Fixed now.
2013-11-07 10:58:02 +01:00
Stefanos A
e59c95f2f9 ES 3.0 fixed enums for GetInteger64*
GetInteger64v should accept GetPName, while GetInteger64i_v should
accept GetIndexedPName.
2013-11-07 10:39:20 +01:00
Stefanos A
8de24c97fb ES 3.0 strong enums for DrawBuffersEXT and NV
Relax the extension constraint in DrawBuffers, in order to add strong
enums to the extension varieties of this function.
2013-11-07 10:33:02 +01:00
Stefanos A
2d1df46d98 ES 3.0 strong enums for DrawArrays*() and Draw*Elements*()
The strongly-typed enums include core and extension varieties.
2013-11-07 10:17:33 +01:00
Stefanos A
0002b2e23e Fixed typo in ES3Generator.cs
The DllImports file should be named ES30Core.cs, not ES3Core.cs. Fixed
now.
2013-11-07 10:09:17 +01:00
Stefanos A
0f98f0e00b Fixed misspelled and missing enums 2013-11-07 09:47:27 +01:00
Stefanos A
93b8d4b86e Fixed enums for (Get)ObjectLabel
ObjectLabel and GetObjectLabel are part of KHR_debug.
2013-11-07 09:34:48 +01:00
Stefanos A
0598e02140 Fixed enums for GetDebugMessageLog
GetDebugMessageLog was misspelled as GetMessageDebugLog. This is now
fixed.
2013-11-07 08:39:57 +01:00
Stefanos A
de38df8820 Fixed strong-enums for GetDebugMessageLog
GetDebugMessageLog is part of KHR_debug.
2013-11-07 08:36:23 +01:00
Stefanos A
a2f2ab29ea Fixes for ES 3.0 strongly-typed enums
Fixed parameter mismatches in CopyBufferSubData and BlendFuncSeparate.
Implemented KHR_debug extension.
2013-11-07 08:33:17 +01:00
Stefanos A
2b4d10ffd7 Strongly-typed enums for ES 3.0 (complete)
Implemented sectiosn: Pixel Rectangles. Binding & Managing Framebuffer
Objects, Renderbuffer Objects, Attaching Renderbuffer Images to
Framebuffer, Attaching Texture Images to Framebuffer, Framebuffer
Completeness, Invaildating Framebuffer Contents, Renderbuffer Object
Queries, Simple Queries, String Queries.
2013-11-07 08:14:49 +01:00
Stefanos A
1a02457ddc Strongly-typed enums for ES 3.0 (WIP8)
Implemented sections: Hints and Sync Object Quries.
Renamed SyncParameter to SyncParameterName, as per the OpenGL naming
conventions.
2013-11-05 10:23:25 +01:00
Stefanos A
167c97dd84 Strongly-typed enums for ES 3.0 (WIP7)
Implemented section: Sync Objects and Fences [5.2].
Fixed desktop OpenGL wrapper for ClientWaitSync and FenceSync.
2013-11-05 09:53:34 +01:00
Stefanos A
2511cb1086 Implemented support for <overload> element
The <overload> element simplifies the addition of overloads for
backwards compatibility. It is defined similar to the <replace>
element, but instead of replacing the parameters of a function
in-place, it adds a new overload and modifies the overload instead.
2013-11-05 08:55:52 +01:00
Stefanos A
25b9939263 Strongly-typed enums for ES 3.0 (WIP6)
Implemented strongly-typed enums for sections: Selecting a Buffer for
Writing, Fine Control of Buffer Updates, Clearing the Buffers.
2013-11-04 23:25:02 +01:00
Stefanos A
372dac9c48 Strongly-typed enums for ES 3.0 (WIP5)
Implemented sections: Stencil Test, Depth Buffer Test, Blending.
2013-11-04 23:01:25 +01:00
Stefanos A
dcd2d03e59 Strongly-typed enums for ES 3.0 (WIP4)
Implemented sections: Texture Image Specification, Alternative Texture
Image Specification, Compressed Texture Images, Texture Parameters,
Manual Mipmap Generation and Enumerated Queries.
2013-11-04 22:27:06 +01:00
Stefanos A
6921509680 Added "reuse" directive for enums
Sometimes an enum may reuse the tokens of another enum verbatim
(possibly adding a few extra tokens.) The reuse directive simplifies
the handling of this case:
<enum name="Foo">
  <reuse enum="Bar" />
</enum>
2013-11-04 22:26:06 +01:00
Stefanos A
20e70062f8 Strongly-typed enums for ES 3.0 (WIP3)
Implemented sections: Texturing, Sampler Objects, Sampler Queries,
Texture Image Specification.
2013-11-04 19:49:25 +01:00
Stefanos A
b29a4aacb3 Respect apiversion in overrides
We should not use overrides from foreign apiversions.
2013-11-04 19:32:52 +01:00
Stefanos A
9b5be9300b Strongly-typed enums for ES 3.0 (WIP2)
Added strongly-typed enums for sections: Vertices, Shaders and
Programs. Added a number of missing enums for ES 2.0. Normalized
several APIs between OpenGL and OpenGL ES.
2013-11-04 00:04:09 +01:00
Stefanos A
af78a01643 Strongly-typed enums for ES 3.0 (WIP)
Implemented strongly-typed enums for sections: Buffer Objects,
Asynchronous Queries, Transform Feedback, ReadingandCopying Pixels and
Rasterization.
2013-11-03 21:30:25 +01:00
Stefanos A
f95925302b No extension attribute now matches all extensions
This allows us to reduce the amount of clutter in overrides.xml.
2013-11-03 21:28:24 +01:00
Stefanos A
7978627ad4 Merge Delegate.Version
When a Delegate is defined multiple times in the spec, we should check
if any of these definitions contains a proper Delegate.Version and
store that. This improves the self-documentation aspect of the bindings.
2013-11-03 20:41:29 +01:00
Stefanos A
7322828304 Regenerated the bindings using the latest specs 2013-11-03 20:36:22 +01:00
Stefanos A
2ca8870420 More PrimitiveType->BeginMode overrides 2013-11-03 20:35:02 +01:00
Stefanos A
c47166e54d Mino fix in debug output
ParameterCollection.ToString() adds parentheses around its output, so
Delegate.ToString() should avoid adding a second pair.
2013-11-03 20:34:18 +01:00
Stefanos A
451bd62f63 ES 3.0 contains both 2.0 and 3.0 bindings
This is in accordance to the upstream gl3.h for ES 3.0.
2013-11-03 20:33:14 +01:00
Stefanos A
d20180cd2d gles1 API contains both versions 1.0 and 1.1
Khronos no longer distinguishes between ES 1.0 and 1.1.
2013-11-03 20:32:47 +01:00
Stefanos A
922fb935a1 Take api version into account
XmlSpecReader will now respect version attributes and will avoid
inserting foreign tokens into the generated bindings.
2013-11-03 20:32:10 +01:00
Stefanos A
2d33b10e1a Improve debug output
Function parameters are now displayed during binding generation.
2013-11-03 20:28:57 +01:00
Stefanos A.
35c0edfa42 Merge categories for redefined functions
Now that we support function overloads, it is safe to ignore functions
that are defined multiple times. We just merge their Category
properties if they are not identical.
2013-11-03 19:13:49 +01:00