Merged changes from gl3 branch.

This commit is contained in:
the_fiddler 2009-02-28 18:50:16 +00:00
parent bc865f5f54
commit 08bf5e52ad
11 changed files with 6823 additions and 1010 deletions

View file

@ -60,7 +60,7 @@ namespace Bind.GL2
// Matches functions that cannot have their trailing 'v' trimmed for CLS-Compliance reasons. // Matches functions that cannot have their trailing 'v' trimmed for CLS-Compliance reasons.
// Built through trial and error :) // Built through trial and error :)
Function.endingsAddV = Function.endingsAddV =
new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?.v)", new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?|TextureParameter.v)",
RegexOptions.Compiled); RegexOptions.Compiled);
Bind.Structures.Type.Initialize(glTypemap, csTypemap); Bind.Structures.Type.Initialize(glTypemap, csTypemap);

View file

@ -14,7 +14,7 @@ namespace Bind.Glu
{ {
class Generator : Bind.GL2.Generator class Generator : Bind.GL2.Generator
{ {
string enumSpecAux;// = "GL2\\enum.spec"; string enumSpecAux = null;// = "GL2\\enum.spec";
#region --- Constructors --- #region --- Constructors ---

View file

@ -183,7 +183,7 @@ namespace Bind
Available switches: Available switches:
-in: Input directory (e.g. -in:../specs/) -in: Input directory (e.g. -in:../specs/)
-out: Output directory (e.g. -out:out) -out: Output directory (e.g. -out:out)
-ns: Output namespace (e.g. -ns:OpenTK.Graphics.OpenGL). -ns: Output namespace (e.g. -ns:OpenTK.Graphics).
Default: OpenTK.Graphics.OpenGL Default: OpenTK.Graphics.OpenGL
-namespace: Same as -ns -namespace: Same as -ns
-class: Output class (e.g. -class:GL3). -class: Output class (e.g. -class:GL3).

View file

@ -18,7 +18,7 @@ namespace Bind
public const string DefaultInputPath = "..\\..\\..\\Source\\Bind\\Specifications"; public const string DefaultInputPath = "..\\..\\..\\Source\\Bind\\Specifications";
public const string DefaultOutputPath = "..\\..\\..\\Source\\OpenTK\\OpenGL\\Bindings"; public const string DefaultOutputPath = "..\\..\\..\\Source\\OpenTK\\OpenGL\\Bindings";
public const string DefaultOutputNamespace = "OpenTK.Graphics.OpenGL"; public const string DefaultOutputNamespace = "OpenTK.Graphics";
public static string GLClass = "GL"; // Needed by Glu for the AuxEnumsClass. Can be set through -gl:"xxx". public static string GLClass = "GL"; // Needed by Glu for the AuxEnumsClass. Can be set through -gl:"xxx".
public static string OutputClass = "GL"; // The real output class. Can be set through -class:"xxx". public static string OutputClass = "GL"; // The real output class. Can be set through -class:"xxx".
@ -67,13 +67,12 @@ namespace Bind
} }
} }
// New enums namespace (no nested class). // New enums namespace (don't use a nested class).
public static string EnumsNamespace;// = "Enums"; public static string EnumsNamespace = null;// = "Enums";
public static string DelegatesClass = "Delegates"; public static string DelegatesClass = "Delegates";
public static string ImportsClass = "Imports"; public static string ImportsClass = "Imports";
// TODO: Remove legacy for for 0.3.15.
public static Legacy Compatibility = Legacy.NoDropMultipleTokens; public static Legacy Compatibility = Legacy.NoDropMultipleTokens;
/// <summary> /// <summary>

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

View file

@ -66,6 +66,7 @@ CullFaceMode,*,*, GLenum,*,*
CullParameterEXT,*,*, GLenum,*,* CullParameterEXT,*,*, GLenum,*,*
DepthFunction,*,*, GLenum,*,* DepthFunction,*,*, GLenum,*,*
DrawBufferMode,*,*, GLenum,*,* DrawBufferMode,*,*, GLenum,*,*
DrawBufferName,*,*, GLint,*,*
DrawElementsType,*,*, GLenum,*,* DrawElementsType,*,*, GLenum,*,*
ElementPointerTypeATI,*,*, GLenum,*,* ElementPointerTypeATI,*,*, GLenum,*,*
EnableCap,*,*, GLenum,*,* EnableCap,*,*, GLenum,*,*
@ -196,7 +197,7 @@ StencilFunction,*,*, GLenum,*,*
StencilFaceDirection,*,*, GLenum,*,* StencilFaceDirection,*,*, GLenum,*,*
StencilOp,*,*, GLenum,*,* StencilOp,*,*, GLenum,*,*
StencilValue,*,*, GLint,*,* StencilValue,*,*, GLint,*,*
String,*,*, GLstring,*,* String,*,*, GLstring,*,* # OpenTK
StringName,*,*, GLenum,*,* StringName,*,*, GLenum,*,*
TangentPointerTypeEXT,*,*, GLenum,*,* TangentPointerTypeEXT,*,*, GLenum,*,*
TessCallback,*,*, GLenum,*,* TessCallback,*,*, GLenum,*,*
@ -282,6 +283,7 @@ Half16NV,*,*, GLhalfNV,*,*
# NV_pixel_data_range # NV_pixel_data_range
PixelDataRangeTargetNV,*,*, GLenum,*,* PixelDataRangeTargetNV,*,*, GLenum,*,*
# Generic types for as-yet-unspecified enums # Generic types for as-yet-unspecified enums
TypeEnum,*,*, GLenum,*,*
GLenum,*,*, GLenum,*,* GLenum,*,*, GLenum,*,*
handleARB,*,*, GLhandleARB,*,* handleARB,*,*, GLhandleARB,*,*
charARB,*,*, GLcharARB,*,* charARB,*,*, GLcharARB,*,*
@ -289,3 +291,27 @@ charPointerARB,*,*, GLcharARB*,*,*
# EXT_timer_query # EXT_timer_query
Int64EXT,*,*, GLint64EXT,*,* Int64EXT,*,*, GLint64EXT,*,*
UInt64EXT,*,*, GLuint64EXT,*,* UInt64EXT,*,*, GLuint64EXT,*,*
# EXT_direct_state_access
#FramebufferAttachment,*,*, GLenum,*,* # OpenTK: already exists
FramebufferAttachmentParameterName,*,*, GLenum,*,*
Framebuffer,*,*, GLuint,*,*
FramebufferStatus,*,*, GLenum,*,*
#FramebufferTarget,*,*, GLenum,*,* # OpenTK: already exists
GetFramebufferParameter,*,*, GLenum,*,*
Intptr,*,*, GLintptr,*,*
ProgramFormat,*,*, GLenum,*,*
ProgramProperty,*,*, GLenum,*,*
ProgramStringProperty,*,*, GLenum,*,*
#ProgramTarget,*,*, GLenum,*,* # OpenTK: already exists
Renderbuffer,*,*, GLuint,*,*
RenderbufferParameterName,*,*, GLenum,*,*
Sizeiptr,*,*, GLsizeiptr,*,*
TextureInternalFormat,*,*, GLenum,*,*
VertexBufferObjectAccess,*,*, GLenum,*,*
VertexBufferObjectParameter,*,*, GLenum,*,*
VertexBufferObjectUsage,*,*, GLenum,*,*
# ARB_map_buffer_range
BufferAccessMask,*,*, GLbitfield,*,*
# NV_explicit_multisample
GetMultisamplePNameNV,*,*, GLenum,*,*
SampleMaskNV,*,*, GLbitfield,*,*

View file

@ -26,8 +26,8 @@ PixelInternalFormat, PixelInternalFormat
GLsizeiptrARB, IntPtr GLsizeiptrARB, IntPtr
GLintptrARB, IntPtr GLintptrARB, IntPtr
GLhandleARB, UInt32 GLhandleARB, UInt32
GLhalfARB, UInt16 GLhalfARB, OpenTK.Math.Half
GLhalfNV, UInt16 GLhalfNV, OpenTK.Math.Half
GLcharARB, Char GLcharARB, Char
# 64 bit types (introduced in 2.1) # 64 bit types (introduced in 2.1)

View file

@ -87,9 +87,9 @@ namespace Bind.Structures
#endregion #endregion
System.Collections.Hashtable _constant_collection = new System.Collections.Hashtable(); Dictionary<string, Constant> _constant_collection = new Dictionary<string, Constant>();
public System.Collections.Hashtable ConstantCollection public IDictionary<string, Constant> ConstantCollection
{ {
get { return _constant_collection; } get { return _constant_collection; }
//set { _constant_collection = value; } //set { _constant_collection = value; }
@ -140,11 +140,23 @@ namespace Bind.Structures
public override string ToString() public override string ToString()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<Constant> constants = new List<Constant>(ConstantCollection.Values);
constants.Sort(delegate(Constant c1, Constant c2)
{
int ret = String.Compare(c1.Value, c2.Value);
if (ret == 0)
return String.Compare(c1.Name, c2.Name);
return ret;
});
sb.AppendLine("public enum " + Name); sb.AppendLine("public enum " + Name);
sb.AppendLine("{"); sb.AppendLine("{");
foreach (Constant c in ConstantCollection.Values)
foreach (Constant c in constants)
{ {
if (c.Name == "PointSmooth")
{
}
sb.Append(" "); sb.Append(" ");
sb.Append(c.ToString()); sb.Append(c.ToString());
if (!String.IsNullOrEmpty(c.ToString())) if (!String.IsNullOrEmpty(c.ToString()))
@ -224,39 +236,35 @@ namespace Bind.Structures
if (Settings.DropMultipleTokens) if (Settings.DropMultipleTokens)
{ {
// When there are multiple tokens with the same value but different extension // When there are multiple tokens with the same value but different extension
// drop the duplicates. Order of preference: core > ARB > EXT > vendor specific // drop the duplicates. Order of preference: core > ARB > EXT > vendor specific
List<Constant> removed_tokens = new List<Constant>();
foreach (Enum e in this.Values) foreach (Enum e in this.Values)
{ {
if (e.Name == "All") if (e.Name == "All")
continue; continue;
// This implementation is a not very bright O(n^2).
foreach (Constant c in e.ConstantCollection.Values) foreach (Constant c in e.ConstantCollection.Values)
{ {
foreach (Constant c2 in e.ConstantCollection.Values) foreach (Constant c2 in e.ConstantCollection.Values)
{ {
if (c.Name != c2.Name && c.Value == c2.Value) if (c.Name != c2.Name && c.Value == c2.Value)
{ {
if (c.Name.Contains(Constant.Translate("TEXTURE_DEFORMATION_BIT_SGIX")) ||
c2.Name.Contains(Constant.Translate("TEXTURE_DEFORMATION_BIT_SGIX")))
{
}
int prefer = OrderOfPreference(Utilities.GetGL2Extension(c.Name), Utilities.GetGL2Extension(c2.Name)); int prefer = OrderOfPreference(Utilities.GetGL2Extension(c.Name), Utilities.GetGL2Extension(c2.Name));
if (prefer == -1) if (prefer == -1)
{ removed_tokens.Add(c2);
c2.Name = "";
c2.Value = "";
}
else if (prefer == 1) else if (prefer == 1)
{ removed_tokens.Add(c);
c.Name = "";
c.Value = "";
}
} }
} }
} }
foreach (Constant c in removed_tokens)
e.ConstantCollection.Remove(c.Name);
removed_tokens.Clear();
} }
} }
} }
@ -264,22 +272,24 @@ namespace Bind.Structures
// Return -1 for ext1, 1 for ext2 or 0 if no preference. // Return -1 for ext1, 1 for ext2 or 0 if no preference.
int OrderOfPreference(string ext1, string ext2) int OrderOfPreference(string ext1, string ext2)
{ {
// If one is empty and the other note, prefer the empty one. // If one is empty and the other not, prefer the empty one (empty == core)
// (empty == core)
// Otherwise check for Arb and Ext. To reuse the logic for the // Otherwise check for Arb and Ext. To reuse the logic for the
// empty check, let's try to remove first Arb, then Ext from the strings. // empty check, let's try to remove first Arb, then Ext from the strings.
int ret; int ret = PreferEmpty(ext1, ext2);
ret = OrderOfPreferenceInternal(ext1, ext2); if (ret != 0)
if (ret != 0) return ret;
ext1 = ext1.Replace("Arb", ""); ext2 = ext2.Replace("Arb", "");
ret = OrderOfPreferenceInternal(ext1, ext2);
if (ret != 0) return ret;
ext1 = ext1.Replace("Ext", ""); ext2 = ext2.Replace("Ext", "");
return ret; return ret;
ext1 = ext1.Replace("Arb", ""); ext2 = ext2.Replace("Arb", "");
ret = PreferEmpty(ext1, ext2);
if (ret != 0)
return ret;
ext1 = ext1.Replace("Ext", ""); ext2 = ext2.Replace("Ext", "");
return PreferEmpty(ext1, ext2);
} }
// Prefer the empty string over the non-empty. // Prefer the empty string over the non-empty.
int OrderOfPreferenceInternal(string ext1, string ext2) int PreferEmpty(string ext1, string ext2)
{ {
if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2)) if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2))
return -1; return -1;

View file

@ -194,7 +194,7 @@ namespace Bind
internal static string GetGL2Extension(string name) internal static string GetGL2Extension(string name)
{ {
name = name.ToUpper(); name = name.ToUpper();
if (name.EndsWith("TEXT")) { return ""; } //if (name.EndsWith("TEXT")) { return ""; }
if (name.EndsWith("ARB")) { return "Arb"; } if (name.EndsWith("ARB")) { return "Arb"; }
if (name.EndsWith("EXT")) { return "Ext"; } if (name.EndsWith("EXT")) { return "Ext"; }
if (name.EndsWith("ATI")) { return "Ati"; } if (name.EndsWith("ATI")) { return "Ati"; }