mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 10:30:38 +00:00
Generator now trims 'v' suffixes from all functions and marks resulting non cls-compliant overloads as such.
Bumped version number.
This commit is contained in:
parent
bfcee69961
commit
a128220c27
|
@ -64,9 +64,9 @@ 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?|TextureParameter.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);
|
||||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.9.9.8")]
|
[assembly: AssemblyVersion("0.9.9.9")]
|
||||||
[assembly: AssemblyFileVersion("0.9.9.8")]
|
[assembly: AssemblyFileVersion("0.9.9.9")]
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace Bind.Structures
|
||||||
internal static DelegateCollection Delegates;
|
internal static DelegateCollection Delegates;
|
||||||
|
|
||||||
private static bool delegatesLoaded;
|
private static bool delegatesLoaded;
|
||||||
|
bool? cls_compliance_overriden;
|
||||||
|
|
||||||
#region internal static void Initialize(string glSpec, string glSpecExt)
|
#region internal static void Initialize(string glSpec, string glSpecExt)
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ namespace Bind.Structures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("Marking CLS compliance for wrappers.");
|
||||||
|
MarkCLSCompliance(Function.Wrappers);
|
||||||
delegatesLoaded = true;
|
delegatesLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +83,9 @@ namespace Bind.Structures
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (cls_compliance_overriden != null)
|
||||||
|
return (bool)cls_compliance_overriden;
|
||||||
|
|
||||||
if (Unsafe)
|
if (Unsafe)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -93,6 +99,10 @@ namespace Bind.Structures
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
cls_compliance_overriden = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -341,9 +351,52 @@ namespace Bind.Structures
|
||||||
|
|
||||||
#region --- Wrapper Creation ---
|
#region --- Wrapper Creation ---
|
||||||
|
|
||||||
#region public IEnumerable<Function> CreateWrappers()
|
#region MarkCLSCompliance
|
||||||
|
|
||||||
public void CreateWrappers()
|
static void MarkCLSCompliance(FunctionCollection collection)
|
||||||
|
{
|
||||||
|
foreach (List<Function> wrappers in Function.Wrappers.Values)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < wrappers.Count; i++)
|
||||||
|
{
|
||||||
|
for (int j = i + 1; j < wrappers.Count; j++)
|
||||||
|
{
|
||||||
|
if (wrappers[i].TrimmedName == wrappers[j].TrimmedName && wrappers[i].Parameters.Count == wrappers[j].Parameters.Count)
|
||||||
|
{
|
||||||
|
bool function_i_is_problematic = false;
|
||||||
|
bool function_j_is_problematic = false;
|
||||||
|
|
||||||
|
int k;
|
||||||
|
for (k = 0; k < wrappers[i].Parameters.Count; k++)
|
||||||
|
{
|
||||||
|
if (wrappers[i].Parameters[k].CurrentType != wrappers[j].Parameters[k].CurrentType)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (wrappers[i].Parameters[k].DiffersOnlyOnReference(wrappers[j].Parameters[k]))
|
||||||
|
if (wrappers[i].Parameters[k].Reference)
|
||||||
|
function_i_is_problematic = true;
|
||||||
|
else
|
||||||
|
function_j_is_problematic = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k == wrappers[i].Parameters.Count)
|
||||||
|
{
|
||||||
|
if (function_i_is_problematic)
|
||||||
|
wrappers[i].CLSCompliant = false;
|
||||||
|
if (function_j_is_problematic)
|
||||||
|
wrappers[j].CLSCompliant = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region CreateWrappers
|
||||||
|
|
||||||
|
void CreateWrappers()
|
||||||
{
|
{
|
||||||
List<Function> wrappers = new List<Function>();
|
List<Function> wrappers = new List<Function>();
|
||||||
if (!NeedsWrapper)
|
if (!NeedsWrapper)
|
||||||
|
|
|
@ -186,6 +186,24 @@ namespace Bind.Structures
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region public bool DiffersOnlyOnReference
|
||||||
|
|
||||||
|
// Returns true if this parameter differs only on reference compared to another parameter, i.e:
|
||||||
|
// returns true for 'int' & 'ref int'
|
||||||
|
// returns true for 'ref float' & 'float'
|
||||||
|
// returns false 'int' & 'int*'
|
||||||
|
// returns false 'int' & 'int[]'
|
||||||
|
// returns false 'int' & 'float'
|
||||||
|
public bool DiffersOnlyOnReference(Parameter other)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
CurrentType == other.CurrentType &&
|
||||||
|
(Reference && !(other.Reference || other.Array > 0 || other.Pointer) ||
|
||||||
|
other.Reference && !(Reference || Array > 0 || Pointer));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region public override string ToString()
|
#region public override string ToString()
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|
Loading…
Reference in a new issue