Merged the latest specs from opengl.org.
Replaced all instances of Version14, Version15, Version20, Version30 and Version31 enums by type-safe equivalents. Added gloverrides.xml to support overrides to function parameters / return types. This will make future spec updates easier to merge. Improved handling of invalid tokens in the specs. Bindings are now written in alphabetical order. This will reduce patch size for future updates and make side-by-side comparisons easier to perform.
This commit is contained in:
parent
14eefe7e5c
commit
cf4a243c99
14 changed files with 101525 additions and 100038 deletions
|
@ -11,6 +11,7 @@ using System.IO;
|
|||
using Bind.Structures;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Bind.GL2
|
||||
{
|
||||
|
@ -30,6 +31,8 @@ namespace Bind.GL2
|
|||
protected static string enumsFile = "GLEnums.cs";
|
||||
protected static string wrappersFile = "GL.cs";
|
||||
|
||||
protected static readonly string functionOverridesFile = "GL2/gloverrides.xml";
|
||||
|
||||
protected static string loadAllFuncName = "LoadAll";
|
||||
|
||||
protected static Regex enumToDotNet = new Regex("_[a-z|A-Z]?", RegexOptions.Compiled);
|
||||
|
@ -38,6 +41,7 @@ namespace Bind.GL2
|
|||
//protected static readonly Dictionary<string, string> doc_replacements;
|
||||
|
||||
DocProcessor doc_processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile));
|
||||
XPathDocument function_overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile));
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -117,10 +121,6 @@ namespace Bind.GL2
|
|||
// Get function name:
|
||||
d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
|
||||
//if (d.Name.Contains("QueryHyperpipeBestAttribSGIX"))
|
||||
//{
|
||||
//}
|
||||
|
||||
do
|
||||
{
|
||||
// Get function parameters and return value
|
||||
|
@ -165,7 +165,7 @@ namespace Bind.GL2
|
|||
}
|
||||
while (!specFile.EndOfStream);
|
||||
|
||||
d.Translate();
|
||||
d.Translate(function_overrides);
|
||||
|
||||
delegates.Add(d);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
475
Source/Bind/Specifications/GL2/gloverrides.xml
Normal file
475
Source/Bind/Specifications/GL2/gloverrides.xml
Normal file
|
@ -0,0 +1,475 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<override>
|
||||
|
||||
<function name="TexImage1D" extension="Core">
|
||||
<param name="internalformat"><type>PixelInternalFormat</type></param>
|
||||
</function>
|
||||
|
||||
<function name="TexImage2D" extension="Core">
|
||||
<param name="internalformat"><type>PixelInternalFormat</type></param>
|
||||
</function>
|
||||
|
||||
<function name="TexImage3D" extension="Core">
|
||||
<param name="internalformat"><type>PixelInternalFormat</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BlendFuncSeparate" extension="Core">
|
||||
<param name="sfactorRGB"><type>BlendingFactorSrc</type></param>
|
||||
<param name="dfactorRGB"><type>BlendingFactorDest</type></param>
|
||||
<param name="sfactorAlpha"><type>BlendingFactorSrc</type></param>
|
||||
<param name="dfactorAlpha"><type>BlendingFactorDest</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FogCoordPointer" extension="Core">
|
||||
<param name="type"><type>FogPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="PointParameter" extension="Core">
|
||||
<param name="pname"><type>PointParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Version 1.5 -->
|
||||
|
||||
<function name="BeginQuery" extension="Core">
|
||||
<param name="target"><type>QueryTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="EndQuery" extension="Core">
|
||||
<param name="target"><type>QueryTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetQuery" extension="Core">
|
||||
<param name="target"><type>QueryTarget</type></param>
|
||||
<param name="pname"><type>GetQueryParam</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetQueryObject" extension="Core">
|
||||
<param name="pname"><type>GetQueryObjectParam</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BindBuffer" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BufferData" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
<param name="usage"><type>BufferUsageHint</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BufferSubData" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferSubData" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="MapBuffer" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
<param name="access"><type>BufferAccess</type></param>
|
||||
</function>
|
||||
|
||||
<function name="UnmapBuffer" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferParameter" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
<param name="pname"><type>BufferParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferPointer" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
<param name="pname"><type>BufferPointer</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Version 2.0-->
|
||||
|
||||
<function name="BlendEquationSeparate" extension="Core">
|
||||
<param name="modeRGB"><type>BlendEquationMode</type></param>
|
||||
<param name="modeAlpha"><type>BlendEquationMode</type></param>
|
||||
</function>
|
||||
|
||||
<function name="DrawBuffers" extension="Core">
|
||||
<param name="bufs"><type>DrawBuffersEnum</type></param>
|
||||
</function>
|
||||
|
||||
<function name="StencilFuncSeparate" extension="Core">
|
||||
<param name="frontfunc"><name>face</name><type>StencilFace</type></param>
|
||||
<param name="backfunc"><name>func</name></param>
|
||||
</function>
|
||||
|
||||
<function name="StencilMaskSeparate" extension="Core">
|
||||
<param name="face"><type>StencilFace</type></param>
|
||||
</function>
|
||||
|
||||
<function name="StencilOpSeparate" extension="Core">
|
||||
<param name="face"><type>StencilFace</type></param>
|
||||
</function>
|
||||
|
||||
<function name="CreateShader" extension="Core">
|
||||
<param name="type"><type>ShaderType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetShader" extension="Core">
|
||||
<param name="pname"><type>ShaderParameter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetActiveAttrib" extension="Core">
|
||||
<param name="type"><type>ActiveAttribType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetActiveUniform" extension="Core">
|
||||
<param name="type"><type>ActiveUniformType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgram" extension="Core">
|
||||
<param name="pname"><type>ProgramParameter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttrib" extension="Core">
|
||||
<param name="pname"><type>VertexAttribParameter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttribI" extension="Core">
|
||||
<param name="pname"><type>VertexAttribParameter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="VertexAttribPointer" extension="Core">
|
||||
<param name="type"><type>VertexAttribPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttribPointer" extension="Core">
|
||||
<param name="pname"><type>VertexAttribPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Version 3.0 -->
|
||||
|
||||
<function name="GetBoolean" extension="Core">
|
||||
<param name="target"><type>GetIndexedPName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetInteger" extension="Core">
|
||||
<param name="target"><type>GetIndexedPName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="Enable" extension="Core">
|
||||
<param name="target"><type>IndexedEnableCap</type></param>
|
||||
</function>
|
||||
|
||||
<function name="Disable" extension="Core">
|
||||
<param name="target"><type>IndexedEnableCap</type></param>
|
||||
</function>
|
||||
|
||||
<function name="IsEnabled" extension="Core">
|
||||
<param name="target"><type>IndexedEnableCap</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BeginTransformFeedback" extension="Core">
|
||||
<param name="primitiveMode"><type>BeginFeedbackMode</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BindBufferRange" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BindBufferBase" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="TransformFeedbackVaryings" extension="Core">
|
||||
<param name="bufferMode"><type>TransformFeedbackMode</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetTransformFeedbackVarying" extension="Core">
|
||||
<param name="type"><type>ActiveAttribType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ClampColor" extension="Core">
|
||||
<param name="target"><type>ClampColorTarget</type></param>
|
||||
<param name="clamp"><type>ClampColorMode</type></param>
|
||||
</function>
|
||||
|
||||
<function name="RenderbufferStorage" extension="Core">
|
||||
<param name="internalformat"><type>RenderbufferStorage</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetRenderbufferParameter" extension="Core">
|
||||
<param name="pname"><type>RenderbufferParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture1D" extension="Core">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture2D" extension="Core">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture3D" extension="Core">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetFramebufferAttachmentParameter" extension="Core">
|
||||
<param name="pname"><type>FramebufferParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="CheckFramebufferStatus" extension="Core">
|
||||
<return>FramebufferErrorCode</return>
|
||||
</function>
|
||||
|
||||
<function name="GenerateMipmap" extension="Core">
|
||||
<param name="target"><type>GenerateMipmapTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BlitFramebuffer" extension="Core">
|
||||
<param name="filter"><type>BlitFramebufferFilter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="RenderbufferStorageMultisample" extension="Core">
|
||||
<param name="target"><type>RenderbufferTarget</type></param>
|
||||
<param name="internalformat"><type>RenderbufferStorage</type></param>
|
||||
</function>
|
||||
|
||||
<function name="MapBufferRange" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FlushMappedBufferRange" extension="Core">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="CopyBufferSubData" extension="Core">
|
||||
<param name="readTarget"><type>BufferTarget</type></param>
|
||||
<param name="writeTarget"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="VertexAttribIPointer" extension="Core">
|
||||
<param name="type"><type>VertexAttribParameter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BeginConditionalRender" extension="Core">
|
||||
<param name="mode"><type>ConditionalRenderType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ClearBuffer" extension="Core">
|
||||
<param name="buffer"><type>ClearBuffer</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetString" extension="Core">
|
||||
<param name="name"><type>StringName</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Version 3.1 -->
|
||||
<function name="TexBuffer" extension="Core">
|
||||
<param name="internalformat"><type>SizedInternalFormat</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Arb -->
|
||||
|
||||
<function name="VertexAttribPointer" extension="Arb">
|
||||
<param name="type"><type>VertexAttribPointerTypeArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ProgramString" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BindProgram" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ProgramEnvParameter4" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ProgramLocalParameter4" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgramEnvParameter4" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgramLocalParameter4" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgram" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
<param name="pname"><type>AssemblyProgramParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgramString" extension="Arb">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
<param name="pname"><type>AssemblyProgramParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttrib" extension="Arb">
|
||||
<param name="pname"><type>VertexAttribParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttribPointer" extension="Arb">
|
||||
<param name="pname"><type>VertexAttribPointerParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BindBuffer" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BufferData" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
<param name="usage"><type>BufferUsageArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BufferSubData" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferSubData" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="MapBuffer" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="UnmapBuffer" extension="Arb">
|
||||
<param name="target"><type>BufferTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferParameter" extension="Arb">
|
||||
<param name="pname"><type>BufferParameterNameArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetBufferPointer" extension="Arb">
|
||||
<param name="pname"><type>BufferPointerNameArb</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Ext -->
|
||||
|
||||
<function name="TangentPointer" extension="Ext">
|
||||
<param name="type"><type>NormalPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BinormalPointer" extension="Ext">
|
||||
<param name="type"><type>NormalPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<function name="RenderbufferStorage" extension="Ext">
|
||||
<param name="internalformat"><type>RenderbufferStorage</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetRenderbufferParameter" extension="Ext">
|
||||
<param name="pname"><type>RenderbufferParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="CheckFramebufferStatus" extension="Ext">
|
||||
<return>FramebufferErrorCode</return>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture1D" extension="Ext">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture2D" extension="Ext">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FramebufferTexture3D" extension="Ext">
|
||||
<param name="textarget"><type>TextureTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetFramebufferAttachmentParameter" extension="Ext">
|
||||
<param name="pname"><type>FramebufferParameterName</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GenerateMipmap" extension="Ext">
|
||||
<param name="target"><type>GenerateMipmapTarget</type></param>
|
||||
</function>
|
||||
|
||||
<function name="BlitFramebuffer">
|
||||
<param name="filter"><type>BlitFramebufferFilter</type></param>
|
||||
</function>
|
||||
|
||||
<function name="RenderbufferStorageMultisample">
|
||||
<param name="target"><type>RenderbufferTarget</type></param>
|
||||
<param name="internalformat"><type>RenderbufferStorage</type></param>
|
||||
</function>
|
||||
|
||||
<!-- Apple -->
|
||||
|
||||
<function name="BufferParameter" extension="Apple">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
<param name="pname"><type>BufferParameterApple</type></param>
|
||||
</function>
|
||||
|
||||
<function name="FlushMappedBufferRange" extension="Apple">
|
||||
<param name="target"><type>BufferTarget</type></param>
|
||||
</function>
|
||||
|
||||
|
||||
<!-- IBM -->
|
||||
|
||||
<function name="FogCoordPointerList" extension="IBM">
|
||||
<param name="type"><type>FogPointerType</type></param>
|
||||
</function>
|
||||
|
||||
<!-- NV -->
|
||||
|
||||
<function name="BindProgram" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ExecuteProgram" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgramParameter" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
<param name="pname"><type>AssemblyProgramParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgram" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetProgramString" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetTrackMatrix" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
<param name="pname"><type>AssemblyProgramParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttrib" extension="NV">
|
||||
<param name="target"><type>VertexAttribParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="GetVertexAttribPointer" extension="NV">
|
||||
<param name="target"><type>VertexAttribParameterPointerArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="LoadProgram" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ProgramParameter4" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="ProgramParameters4" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="TrackMatrix" extension="NV">
|
||||
<param name="target"><type>AssemblyProgramTargetArb</type></param>
|
||||
</function>
|
||||
|
||||
<function name="VertexAttribPointer" extension="NV">
|
||||
<param name="type"><type>VertexAttribParameterArb</type></param>
|
||||
</function>
|
||||
|
||||
|
||||
</override>
|
|
@ -162,28 +162,37 @@ namespace Bind.Structures
|
|||
/// <param name="c">The Constant to translate</param>
|
||||
/// <param name="enums">The list of enums to check.</param>
|
||||
/// <param name="auxEnums">The list of auxilliary enums to check.</param>
|
||||
public static void TranslateConstantWithReference(Constant c, EnumCollection enums, EnumCollection auxEnums)
|
||||
/// <returns>True if the reference was found; false otherwise.</returns>
|
||||
public static bool TranslateConstantWithReference(Constant c, EnumCollection enums, EnumCollection auxEnums)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(c.Reference))
|
||||
{
|
||||
string value;
|
||||
Constant referenced_constant;
|
||||
|
||||
if (enums[c.Reference].ConstantCollection.ContainsKey(c.Value))
|
||||
if (enums.ContainsKey(c.Reference) && enums[c.Reference].ConstantCollection.ContainsKey(c.Value))
|
||||
{
|
||||
TranslateConstantWithReference(enums[c.Reference].ConstantCollection[c.Value] as Constant, enums, auxEnums);
|
||||
value = (enums[c.Reference].ConstantCollection[c.Value] as Constant).Value;
|
||||
referenced_constant = (enums[c.Reference].ConstantCollection[c.Value] as Constant);
|
||||
}
|
||||
else if (auxEnums.Count > 0 && auxEnums[c.Reference].ConstantCollection.ContainsKey(c.Value))
|
||||
else if (auxEnums.ContainsKey(c.Reference) && auxEnums[c.Reference].ConstantCollection.ContainsKey(c.Value))
|
||||
{
|
||||
TranslateConstantWithReference(auxEnums[c.Reference].ConstantCollection[c.Value] as Constant, enums, auxEnums);
|
||||
value = (auxEnums[c.Reference].ConstantCollection[c.Value] as Constant).Value;
|
||||
referenced_constant = (auxEnums[c.Reference].ConstantCollection[c.Value] as Constant);
|
||||
}
|
||||
else throw new InvalidOperationException(String.Format("Unknown Enum \"{0}\" referenced by Constant \"{1}\"",
|
||||
c.Reference, c.ToString()));
|
||||
else
|
||||
{
|
||||
Console.WriteLine("[Warning] Reference {0} not found for token {1}.", c.Reference, c);
|
||||
return false;
|
||||
}
|
||||
//else throw new InvalidOperationException(String.Format("Unknown Enum \"{0}\" referenced by Constant \"{1}\"",
|
||||
// c.Reference, c.ToString()));
|
||||
|
||||
c.Value = value;
|
||||
c.Value = referenced_constant.Value;
|
||||
c.Reference = null;
|
||||
c.Unchecked = referenced_constant.Unchecked;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#region public override string ToString()
|
||||
|
|
|
@ -10,6 +10,9 @@ using System.Text;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Bind.Structures
|
||||
{
|
||||
|
@ -23,6 +26,15 @@ namespace Bind.Structures
|
|||
|
||||
private static bool delegatesLoaded;
|
||||
bool? cls_compliance_overriden;
|
||||
|
||||
protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
|
||||
protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flagv|Tess|Status|Pixels|Instanced|Indexed|Varyings)", RegexOptions.Compiled | RegexOptions.RightToLeft);
|
||||
|
||||
// Add a trailing v to functions matching this regex. Used to differntiate between overloads taking both
|
||||
// a 'type' and a 'ref type' (such overloads are not CLS Compliant).
|
||||
// The default Regex matches no functions. Create a new Regex in Bind.Generator classes to override the default behavior.
|
||||
internal static Regex endingsAddV = new Regex("^0", RegexOptions.Compiled);
|
||||
|
||||
|
||||
#region internal static void Initialize(string glSpec, string glSpecExt)
|
||||
|
||||
|
@ -451,7 +463,49 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region void TranslateReturnType()
|
||||
#region TrimName
|
||||
|
||||
// Trims unecessary suffices from the specified OpenGL function name.
|
||||
protected static string TrimName(string name, bool keep_extension)
|
||||
{
|
||||
string trimmed_name = Utilities.StripGL2Extension(name);
|
||||
string extension = Utilities.GetGL2Extension(name);
|
||||
|
||||
// Note: some endings should not be trimmed, for example: 'b' from Attrib.
|
||||
// Check the endingsNotToTrim regex for details.
|
||||
Match m = endingsNotToTrim.Match(trimmed_name);
|
||||
if ((m.Index + m.Length) != trimmed_name.Length)
|
||||
{
|
||||
m = endings.Match(trimmed_name);
|
||||
|
||||
if (m.Length > 0 && m.Index + m.Length == trimmed_name.Length)
|
||||
{
|
||||
// Only trim endings, not internal matches.
|
||||
if (m.Value[m.Length - 1] == 'v' && endingsAddV.IsMatch(name) &&
|
||||
!name.StartsWith("Get") && !name.StartsWith("MatrixIndex"))
|
||||
{
|
||||
// Only trim ending 'v' when there is a number
|
||||
trimmed_name = trimmed_name.Substring(0, m.Index) + "v";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!trimmed_name.EndsWith("xedv"))
|
||||
trimmed_name = trimmed_name.Substring(0, m.Index);
|
||||
else
|
||||
trimmed_name = trimmed_name.Substring(0, m.Index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (keep_extension)
|
||||
return trimmed_name + extension;
|
||||
else
|
||||
return trimmed_name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TranslateReturnType
|
||||
|
||||
/// <summary>
|
||||
/// Translates the opengl return type to the equivalent C# type.
|
||||
|
@ -466,7 +520,7 @@ namespace Bind.Structures
|
|||
/// 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise).
|
||||
/// Return types must always be CLS-compliant, because .Net does not support overloading on return types.
|
||||
/// </remarks>
|
||||
void TranslateReturnType()
|
||||
void TranslateReturnType(XPathNavigator function_override)
|
||||
{
|
||||
/*
|
||||
if (Bind.Structures.Type.GLTypes.ContainsKey(ReturnType.CurrentType))
|
||||
|
@ -476,6 +530,15 @@ namespace Bind.Structures
|
|||
ReturnType.CurrentType = Bind.Structures.Type.CSTypes[ReturnType.CurrentType];
|
||||
*/
|
||||
|
||||
if (function_override != null)
|
||||
{
|
||||
XPathNavigator return_override = function_override.SelectSingleNode("return");
|
||||
if (return_override != null)
|
||||
{
|
||||
ReturnType.CurrentType = return_override.Value;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnType.Translate(this.Category);
|
||||
|
||||
if (ReturnType.CurrentType.ToLower().Contains("void") && ReturnType.Pointer)
|
||||
|
@ -509,20 +572,35 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region protected virtual void TranslateParameters()
|
||||
#region TranslateParameters
|
||||
|
||||
protected virtual void TranslateParameters()
|
||||
protected virtual void TranslateParameters(XPathNavigator function_override)
|
||||
{
|
||||
// Iterates through all parameters, calling the Parameter.Translate() function.
|
||||
|
||||
for (int i = 0; i < Parameters.Count; i++)
|
||||
{
|
||||
if (function_override != null)
|
||||
{
|
||||
XPathNavigator param_override = function_override.SelectSingleNode(String.Format("param[@name='{0}']", Parameters[i].Name));
|
||||
if (param_override != null)
|
||||
{
|
||||
foreach (XPathNavigator node in param_override.SelectChildren(XPathNodeType.Element))
|
||||
{
|
||||
switch (node.Name)
|
||||
{
|
||||
case "type": Parameters[i].CurrentType = (string)node.TypedValue; break;
|
||||
case "name": Parameters[i].Name = (string)node.TypedValue; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Parameters[i].Translate(this.Category);
|
||||
|
||||
if (Parameters[i].CurrentType == "UInt16" && Name.Contains("LineStipple"))
|
||||
Parameters[i].WrapperType = WrapperTypes.UncheckedParameter;
|
||||
|
||||
// Special case: these functions take a string[]
|
||||
// Special case: these functions take a string[] that should stay as is.
|
||||
// Todo: move to gloverrides.xml
|
||||
if (Name.Contains("ShaderSource") && Parameters[i].CurrentType.ToLower().Contains("string"))
|
||||
Parameters[i].Array = 1;
|
||||
}
|
||||
|
@ -530,10 +608,17 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
internal void Translate()
|
||||
internal void Translate(XPathDocument overrides)
|
||||
{
|
||||
TranslateReturnType();
|
||||
TranslateParameters();
|
||||
if (overrides == null)
|
||||
throw new ArgumentNullException("overrides");
|
||||
|
||||
XPathNavigator navigator = overrides.CreateNavigator();
|
||||
string path = "/override/function[@name='{0}' and @extension='{1}']";
|
||||
string name = TrimName(Name, false);
|
||||
XPathNavigator function_override = overrides.CreateNavigator().SelectSingleNode(String.Format(path, name, Extension));
|
||||
TranslateReturnType(function_override);
|
||||
TranslateParameters(function_override);
|
||||
|
||||
CreateWrappers();
|
||||
}
|
||||
|
@ -541,9 +626,9 @@ namespace Bind.Structures
|
|||
#endregion
|
||||
}
|
||||
|
||||
#region class DelegateCollection : Dictionary<string, Delegate>
|
||||
#region class DelegateCollection : SortedDictionary<string, Delegate>
|
||||
|
||||
class DelegateCollection : Dictionary<string, Delegate>
|
||||
class DelegateCollection : SortedDictionary<string, Delegate>
|
||||
{
|
||||
public void Add(Delegate d)
|
||||
{
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace Bind.Structures
|
|||
|
||||
#region class EnumCollection
|
||||
|
||||
public class EnumCollection : Dictionary<string, Enum>
|
||||
public class EnumCollection : SortedDictionary<string, Enum>
|
||||
{
|
||||
internal void AddRange(EnumCollection enums)
|
||||
{
|
||||
|
@ -258,8 +258,18 @@ namespace Bind.Structures
|
|||
}
|
||||
|
||||
foreach (Enum e in this.Values)
|
||||
{
|
||||
restart:
|
||||
foreach (Constant c in e.ConstantCollection.Values)
|
||||
Constant.TranslateConstantWithReference(c, Enum.GLEnums, Enum.AuxEnums);
|
||||
{
|
||||
bool result = Constant.TranslateConstantWithReference(c, Enum.GLEnums, Enum.AuxEnums);
|
||||
if (!result)
|
||||
{
|
||||
e.ConstantCollection.Remove(c.Name);
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings.DropMultipleTokens)
|
||||
{
|
||||
|
|
|
@ -33,14 +33,6 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
static Regex endings = new Regex(@"((([df]|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
|
||||
static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flagv|Tess|Status|Pixels|Instanced|Indexed|Varyings)", RegexOptions.Compiled | RegexOptions.RightToLeft);
|
||||
|
||||
// Add a trailing v to functions matching this regex. Used to differntiate between overloads taking both
|
||||
// a 'type' and a 'ref type' (such overloads are not CLS Compliant).
|
||||
// The default Regex matches no functions. Create a new Regex in Bind.Generator classes to override the default behavior.
|
||||
internal static Regex endingsAddV = new Regex("^0", RegexOptions.Compiled);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
|
@ -636,9 +628,9 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region class FunctionCollection : Dictionary<string, List<Function>>
|
||||
#region class FunctionCollection : SortedDictionary<string, List<Function>>
|
||||
|
||||
class FunctionCollection : Dictionary<string, List<Function>>
|
||||
class FunctionCollection : SortedDictionary<string, List<Function>>
|
||||
{
|
||||
Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
|
||||
|
||||
|
@ -669,10 +661,6 @@ namespace Bind.Structures
|
|||
/// <param name="f">The Function to add.</param>
|
||||
public void AddChecked(Function f)
|
||||
{
|
||||
if (f.Name.Contains("Color3ub"))
|
||||
{
|
||||
}
|
||||
|
||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||
{
|
||||
int index = Bind.Structures.Function.Wrappers[f.Extension].IndexOf(f);
|
||||
|
|
102
Source/Examples/Properties/Resources.Designer.cs
generated
102
Source/Examples/Properties/Resources.Designer.cs
generated
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3074
|
||||
// Runtime Version:2.0.50727.4918
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -193,46 +193,6 @@ namespace Examples.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {\rtf1\ansi\ansicpg1253\deff0\deflang1032{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fcharset0 Arial;}{\f2\fswiss\fcharset161{\*\fname Arial;}Arial Greek;}{\f3\fswiss\fprq2\fcharset161{\*\fname Arial;}Arial Greek;}{\f4\fmodern\fprq1\fcharset0 Consolas;}}
|
||||
///{\colortbl ;\red0\green0\blue255;\red43\green145\blue175;}
|
||||
///{\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\qc\lang1033\b\f0\fs32 Font rendering\par
|
||||
///\b0\f1\fs20\par
|
||||
///\lang1032\f2\par
|
||||
///\pard\lang1033\b\f1\fs24 Overview\par
|
||||
///\par
|
||||
///\b0\f [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FontRenderingBasic {
|
||||
get {
|
||||
return ResourceManager.GetString("FontRenderingBasic", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to namespace Examples.WinForms
|
||||
///{
|
||||
/// partial class FontRenderingBasic
|
||||
/// {
|
||||
/// /// <summary>
|
||||
/// /// Required designer variable.
|
||||
/// /// </summary>
|
||||
/// private System.ComponentModel.IContainer components = null;
|
||||
///
|
||||
/// /// <summary>
|
||||
/// /// Clean up any resources being used.
|
||||
/// /// </summary>
|
||||
/// /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
/// protected override void Dispose(bool disposing)
|
||||
/// {
|
||||
/// [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FontRenderingBasic_Designer {
|
||||
get {
|
||||
return ResourceManager.GetString("FontRenderingBasic_Designer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to using System;
|
||||
///using System.Collections.Generic;
|
||||
|
@ -252,34 +212,25 @@ namespace Examples.Properties {
|
|||
///
|
||||
/// float[] sizes = new float[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1 [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FontRenderingBasic1 {
|
||||
internal static string FontRenderingBasic {
|
||||
get {
|
||||
return ResourceManager.GetString("FontRenderingBasic1", resourceCulture);
|
||||
return ResourceManager.GetString("FontRenderingBasic", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?>
|
||||
///<root>
|
||||
/// <!--
|
||||
/// Microsoft ResX Schema
|
||||
///
|
||||
/// Version 2.0
|
||||
///
|
||||
/// The primary goals of this format is to allow a simple XML format
|
||||
/// that is mostly human readable. The generation and parsing of the
|
||||
/// various data types are done through the TypeConverter classes
|
||||
/// associated with the data types.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// ... ado.net/XML headers & schema ...
|
||||
/// <resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
/// <resheader n [rest of string was truncated]";.
|
||||
/// Looks up a localized string similar to {\rtf1\ansi\ansicpg1253\deff0\deflang1032{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fcharset0 Arial;}{\f2\fswiss\fcharset161{\*\fname Arial;}Arial Greek;}{\f3\fswiss\fprq2\fcharset161{\*\fname Arial;}Arial Greek;}{\f4\fmodern\fprq1\fcharset0 Consolas;}}
|
||||
///{\colortbl ;\red0\green0\blue255;\red43\green145\blue175;}
|
||||
///{\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\qc\lang1033\b\f0\fs32 Font rendering\par
|
||||
///\b0\f1\fs20\par
|
||||
///\lang1032\f2\par
|
||||
///\pard\lang1033\b\f1\fs24 Overview\par
|
||||
///\par
|
||||
///\b0\f [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FontRenderingBasic2 {
|
||||
internal static string FontRenderingBasicDoc {
|
||||
get {
|
||||
return ResourceManager.GetString("FontRenderingBasic2", resourceCulture);
|
||||
return ResourceManager.GetString("FontRenderingBasicDoc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,9 +257,9 @@ namespace Examples.Properties {
|
|||
///{
|
||||
/// [Example("Framebuffer Objects", ExampleCategory.OpenGL, "FB [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FrameBufferObject {
|
||||
internal static string FramebufferObject {
|
||||
get {
|
||||
return ResourceManager.GetString("FrameBufferObject", resourceCulture);
|
||||
return ResourceManager.GetString("FramebufferObject", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,9 +272,9 @@ namespace Examples.Properties {
|
|||
///\par
|
||||
///\b0\fs22 This sample demonstrates Framebuffer objects (FBOs) via the EXT_framebuffer_object extension. FBOs provide an efficient method to perfo [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string FramebufferObject1 {
|
||||
internal static string FramebufferObjectDoc {
|
||||
get {
|
||||
return ResourceManager.GetString("FramebufferObject1", resourceCulture);
|
||||
return ResourceManager.GetString("FramebufferObjectDoc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,10 +298,8 @@ namespace Examples.Properties {
|
|||
///
|
||||
///namespace Examples.Tests
|
||||
///{
|
||||
/// [Example("GameWindow states", ExampleCategory.OpenTK, "Test")]
|
||||
/// public class GameWindowStates : GameWindow
|
||||
/// {
|
||||
/// Font font [rest of string was truncated]";.
|
||||
/// [Example("GameWindow states", ExampleCategory.OpenTK, "Test", Documentation="GameWindowStates")]
|
||||
/// public class GameWindowStates : Ga [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string GameWindowStates {
|
||||
get {
|
||||
|
@ -497,12 +446,12 @@ namespace Examples.Properties {
|
|||
///
|
||||
///namespace Examples.WinForms
|
||||
///{
|
||||
/// [Example("Multiple GLControls", ExampleCategory.OpenTK, "GLControl", 3, Documentation="MultipleGLControls.cs")]
|
||||
/// [Example("Multiple GLControls", ExampleCategory.OpenTK, "GLControl", 3, Documentation="MultipleGLControls")]
|
||||
/// public partial class MultipleGLControlsForm : Form
|
||||
/// {
|
||||
/// public MultipleGLControlsForm()
|
||||
/// {
|
||||
/// InitializeComp [rest of string was truncated]";.
|
||||
/// InitializeCompone [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string MultipleGLControls {
|
||||
get {
|
||||
|
@ -527,10 +476,10 @@ namespace Examples.Properties {
|
|||
///
|
||||
///namespace Examples
|
||||
///{
|
||||
/// [Example("Playback", ExampleCategory.OpenAL, "1.1")]
|
||||
/// [Example("Playback", ExampleCategory.OpenAL, "1.1", Documentation="Playback")]
|
||||
/// public class Playback
|
||||
/// {
|
||||
/// static readonly string filename = Path.Combine(Path.Combine("Data", " [rest of string was truncated]";.
|
||||
/// static readonly string filename = Path.Comb [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string Playback {
|
||||
get {
|
||||
|
@ -755,8 +704,7 @@ namespace Examples.Properties {
|
|||
///
|
||||
///namespace Examples.Tests
|
||||
///{
|
||||
/// [Example("Test Resolution Changes", ExampleCategory.OpenTK, "Test")]
|
||||
/// [rest of string was truncated]";.
|
||||
/// [Example("Test Resolution Changes", ExampleCategory.OpenTK, "Test", Docum [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string TestResolutionChanges {
|
||||
get {
|
||||
|
@ -851,7 +799,7 @@ namespace Examples.Properties {
|
|||
///
|
||||
///namespace Examples.Tutorial
|
||||
///{
|
||||
/// [Example("Vertex Buffer Objects", ExampleCategory.OpenGL, "1.5", Docume [rest of string was truncated]";.
|
||||
/// [Example("Vertex Buffer Objects", ExampleCategory.OpenGL, "1.5", false, [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string VertexBufferObject {
|
||||
get {
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue