mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 02:45:36 +00:00
Made IsFlagsCollection read-write
The decision whether an Enum is a flags collection is now made either by the spec reader or the enum processor (not the Enum class itself.)
This commit is contained in:
parent
2444ccf082
commit
97ca64121c
|
@ -23,13 +23,7 @@ namespace Bind.Structures
|
||||||
// Returns true if the enum contains a collection of flags, i.e. 1, 2, 4, 8, ...
|
// Returns true if the enum contains a collection of flags, i.e. 1, 2, 4, 8, ...
|
||||||
public bool IsFlagCollection
|
public bool IsFlagCollection
|
||||||
{
|
{
|
||||||
get
|
get; set;
|
||||||
{
|
|
||||||
// It seems that all flag collections contain "Mask" in their names.
|
|
||||||
// This looks like a heuristic, but it holds 100% in practice
|
|
||||||
// (checked all enums to make sure).
|
|
||||||
return Name.Contains("Mask");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -95,6 +89,11 @@ namespace Bind.Structures
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Add(Constant constant)
|
||||||
|
{
|
||||||
|
ConstantCollection.Add(constant.Name, constant);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -157,9 +157,16 @@ namespace Bind
|
||||||
Name = node.GetAttribute("name", String.Empty),
|
Name = node.GetAttribute("name", String.Empty),
|
||||||
Type = node.GetAttribute("type", String.Empty)
|
Type = node.GetAttribute("type", String.Empty)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(e.Name))
|
if (String.IsNullOrEmpty(e.Name))
|
||||||
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
|
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
|
||||||
|
|
||||||
|
|
||||||
|
// It seems that all flag collections contain "Mask" in their names.
|
||||||
|
// This looks like a heuristic, but it holds 100% in practice
|
||||||
|
// (checked all enums to make sure).
|
||||||
|
e.IsFlagCollection = e.Name.ToLower().Contains("mask");
|
||||||
|
|
||||||
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
|
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
|
||||||
{
|
{
|
||||||
Constant c = null;
|
Constant c = null;
|
||||||
|
|
|
@ -50653,7 +50653,6 @@ namespace OpenTK.Graphics.OpenGL
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not used directly.
|
/// Not used directly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
|
||||||
public enum SgisTextureColorMask : int
|
public enum SgisTextureColorMask : int
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue