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.
// Built through trial and error :)
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);
Bind.Structures.Type.Initialize(glTypemap, csTypemap);

View file

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

View file

@ -183,7 +183,7 @@ namespace Bind
Available switches:
-in: Input directory (e.g. -in:../specs/)
-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
-namespace: Same as -ns
-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 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 OutputClass = "GL"; // The real output class. Can be set through -class:"xxx".
@ -67,13 +67,12 @@ namespace Bind
}
}
// New enums namespace (no nested class).
public static string EnumsNamespace;// = "Enums";
// New enums namespace (don't use a nested class).
public static string EnumsNamespace = null;// = "Enums";
public static string DelegatesClass = "Delegates";
public static string ImportsClass = "Imports";
// TODO: Remove legacy for for 0.3.15.
public static Legacy Compatibility = Legacy.NoDropMultipleTokens;
/// <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,*,*
DepthFunction,*,*, GLenum,*,*
DrawBufferMode,*,*, GLenum,*,*
DrawBufferName,*,*, GLint,*,*
DrawElementsType,*,*, GLenum,*,*
ElementPointerTypeATI,*,*, GLenum,*,*
EnableCap,*,*, GLenum,*,*
@ -196,7 +197,7 @@ StencilFunction,*,*, GLenum,*,*
StencilFaceDirection,*,*, GLenum,*,*
StencilOp,*,*, GLenum,*,*
StencilValue,*,*, GLint,*,*
String,*,*, GLstring,*,*
String,*,*, GLstring,*,* # OpenTK
StringName,*,*, GLenum,*,*
TangentPointerTypeEXT,*,*, GLenum,*,*
TessCallback,*,*, GLenum,*,*
@ -282,6 +283,7 @@ Half16NV,*,*, GLhalfNV,*,*
# NV_pixel_data_range
PixelDataRangeTargetNV,*,*, GLenum,*,*
# Generic types for as-yet-unspecified enums
TypeEnum,*,*, GLenum,*,*
GLenum,*,*, GLenum,*,*
handleARB,*,*, GLhandleARB,*,*
charARB,*,*, GLcharARB,*,*
@ -289,3 +291,27 @@ charPointerARB,*,*, GLcharARB*,*,*
# EXT_timer_query
Int64EXT,*,*, GLint64EXT,*,*
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
GLintptrARB, IntPtr
GLhandleARB, UInt32
GLhalfARB, UInt16
GLhalfNV, UInt16
GLhalfARB, OpenTK.Math.Half
GLhalfNV, OpenTK.Math.Half
GLcharARB, Char
# 64 bit types (introduced in 2.1)

View file

@ -87,9 +87,9 @@ namespace Bind.Structures
#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; }
//set { _constant_collection = value; }
@ -140,11 +140,23 @@ namespace Bind.Structures
public override string ToString()
{
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("{");
foreach (Constant c in ConstantCollection.Values)
foreach (Constant c in constants)
{
if (c.Name == "PointSmooth")
{
}
sb.Append(" ");
sb.Append(c.ToString());
if (!String.IsNullOrEmpty(c.ToString()))
@ -224,39 +236,35 @@ namespace Bind.Structures
if (Settings.DropMultipleTokens)
{
// When there are multiple tokens with the same value but different extension
// drop the duplicates. Order of preference: core > ARB > EXT > vendor specific
List<Constant> removed_tokens = new List<Constant>();
foreach (Enum e in this.Values)
{
if (e.Name == "All")
continue;
// This implementation is a not very bright O(n^2).
foreach (Constant c in e.ConstantCollection.Values)
{
foreach (Constant c2 in e.ConstantCollection.Values)
{
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));
if (prefer == -1)
{
c2.Name = "";
c2.Value = "";
}
removed_tokens.Add(c2);
else if (prefer == 1)
{
c.Name = "";
c.Value = "";
}
removed_tokens.Add(c);
}
}
}
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.
int OrderOfPreference(string ext1, string ext2)
{
// If one is empty and the other note, prefer the empty one.
// (empty == core)
// If one is empty and the other not, prefer the empty one (empty == core)
// 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.
int ret;
ret = OrderOfPreferenceInternal(ext1, ext2);
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", "");
int ret = PreferEmpty(ext1, ext2);
if (ret != 0)
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.
int OrderOfPreferenceInternal(string ext1, string ext2)
int PreferEmpty(string ext1, string ext2)
{
if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2))
return -1;

View file

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