1
0
Fork 0
mirror of https://github.com/Ryujinx/Opentk.git synced 2025-01-13 18:35:32 +00:00

Merge pull request from thefiddler/buffersize_to_int

[Bind] Add int overloads to buffer size (IntPtr) parameters
This commit is contained in:
thefiddler 2014-09-02 13:03:42 +02:00
commit 6bb7c1d406
2 changed files with 34 additions and 9 deletions

View file

@ -324,19 +324,18 @@ namespace Bind
}
else
{
// Todo: what is the point of this here? It is overwritten below.
// A few translations for consistency
switch (type.CurrentType.ToLower())
{
case "string":
type.QualifiedType = "String";
break;
}
type.QualifiedType = s;
}
}
if ((type.Array == 0 && type.Pointer == 0 && !type.Reference) &&
(type.QualifiedType.ToLower().Contains("buffersize") ||
type.QualifiedType.ToLower().Contains("sizeiptr") ||
type.QualifiedType.Contains("size_t")))
{
type.WrapperType |= WrapperTypes.SizeParameter;
}
type.CurrentType =
Generator.CSTypes.ContainsKey(type.CurrentType) ?
Generator.CSTypes[type.CurrentType] : type.CurrentType;
@ -960,6 +959,27 @@ namespace Bind
convenience_wrappers.Add(f);
}
}
// Check for IntPtr parameters that correspond to size_t (e.g. GLsizei)
// and add Int32 overloads for convenience.
{
Function f = null;
int i = 0;
foreach (var p in d.Parameters)
{
if ((p.WrapperType & WrapperTypes.SizeParameter) != 0)
{
f = f ?? new Function(d);
f.Parameters[i].QualifiedType = "Int32";
}
i++;
}
if (f != null)
{
convenience_wrappers.Add(f);
}
}
}
return convenience_wrappers;
}

View file

@ -89,6 +89,11 @@ namespace Bind
/// Function takes a String[] parameter
/// </summary>
StringArrayParameter = 1 << 13,
/// <summary>
/// Functions takes an IntPtr that corresponds to a size_t.
/// Add an int32 overload for convenience.
/// </summary>
SizeParameter = 1 << 14,
}
#endregion