mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 01:05:33 +00:00
Add feature to Bind to generate legacy array overloads
This commit is contained in:
parent
6bd1f0e603
commit
ffa26fb204
|
@ -648,6 +648,22 @@ namespace Bind
|
|||
{
|
||||
d.Parameters[i].WrapperType |= WrapperTypes.UncheckedParameter;
|
||||
}
|
||||
|
||||
if (function_override != null)
|
||||
{
|
||||
XPathNavigator param_override = function_override.SelectSingleNode(String.Format(
|
||||
"param[@name='{0}' or @index='{1}']",
|
||||
d.Parameters[i].RawName,
|
||||
i));
|
||||
if (param_override != null)
|
||||
{
|
||||
var legacyArrayParameter = param_override.GetAttribute("legacyArrayParameter", String.Empty);
|
||||
if (!String.IsNullOrEmpty(legacyArrayParameter))
|
||||
{
|
||||
d.Parameters[i].WrapperType |= WrapperTypes.LegacyArrayParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1097,6 +1113,17 @@ namespace Bind
|
|||
// Generics are handled in a second pass.
|
||||
if ((parameter.WrapperType & WrapperTypes.GenericParameter) == 0)
|
||||
{
|
||||
if ((parameter.WrapperType & WrapperTypes.LegacyArrayParameter) != 0)
|
||||
{
|
||||
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.LegacyArrayParameter, func))
|
||||
{
|
||||
wrapper.Obsolete = "Use out overload instead";
|
||||
var p = wrapper.Parameters[i];
|
||||
p.Array++;
|
||||
p.Pointer--;
|
||||
}
|
||||
}
|
||||
|
||||
if ((parameter.WrapperType & WrapperTypes.ArrayParameter) != 0)
|
||||
{
|
||||
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.ArrayParameter, func))
|
||||
|
|
|
@ -94,6 +94,10 @@ namespace Bind
|
|||
/// Add an int32 overload for convenience.
|
||||
/// </summary>
|
||||
SizeParameter = 1 << 14,
|
||||
/// <summary>
|
||||
/// Function takes a ref but we emit a legacy array overload to maintain backwards compatability.
|
||||
/// </summary>
|
||||
LegacyArrayParameter = 1 << 15,
|
||||
}
|
||||
|
||||
internal static class Utilities
|
||||
|
|
Loading…
Reference in a new issue