mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-22 19:41:00 +00:00
Read extension list from xml spec; new acronyms.
Instead of hardcoding a list of extensions, extensions are now read directly from the signatures.xml file. Acronyms for new texture formats are now listed.
This commit is contained in:
parent
5cc845713d
commit
5e06c14607
|
@ -7,6 +7,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Bind.Structures;
|
using Bind.Structures;
|
||||||
using Delegate=Bind.Structures.Delegate;
|
using Delegate=Bind.Structures.Delegate;
|
||||||
|
@ -69,11 +70,34 @@ namespace Bind
|
||||||
public static class Utilities
|
public static class Utilities
|
||||||
{
|
{
|
||||||
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
|
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
|
||||||
public static readonly Regex Extensions = new Regex(
|
public static Regex Extensions { get; private set; }
|
||||||
"ARB|EXT|ATIX|ATI|AMDX|AMD|NV|NVX|SUNX|SUN|SGIS|SGIX|SGI|MESAX|MESA|3DFX|IBM|GREMEDY|HP|INTEL|PGI|INGR|APPLE|OML|I3D|ARM|ANGLE|OES|QCOM|VIV|IMG",
|
public static Regex Acronyms { get; private set; }
|
||||||
RegexOptions.Compiled);
|
//public static readonly Regex Extensions = new Regex(
|
||||||
public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|GL|CL|RGBA|BGRA|RGB|BGR|ETC",
|
// "ARB|EXT|ATIX|ATI|AMDX|AMD|NV|NVX|SUNX|SUN|SGIS|SGIX|SGI|MESAX|MESA|3DFX|IBM|GREMEDY|HP|INTEL|PGI|INGR|APPLE|OML|I3D|ARM|ANGLE|OES|QCOM|VIV|IMG",
|
||||||
RegexOptions.Compiled);
|
// RegexOptions.Compiled);
|
||||||
|
//public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|GL|CL|RGBA|BGRA|RGB|BGR|ETC",
|
||||||
|
// RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public static void InitExtensions(IEnumerable<string> extensions)
|
||||||
|
{
|
||||||
|
var acronyms = new string[]
|
||||||
|
{
|
||||||
|
"EGL", "ES", "GL", "CL",
|
||||||
|
"RGBA", "BGRA", "RGB", "BGR",
|
||||||
|
"SRGB", "YCBCR",
|
||||||
|
"3TC", "DXT", "BPTC", "RGTC",
|
||||||
|
"3DC", "ATC", "ETC",
|
||||||
|
"ANGLE", "MESAX", "MESA",
|
||||||
|
};
|
||||||
|
|
||||||
|
Extensions = new Regex(
|
||||||
|
String.Join("|", extensions.ToArray()),
|
||||||
|
RegexOptions.Compiled);
|
||||||
|
|
||||||
|
Acronyms = new Regex(
|
||||||
|
String.Join("|", extensions.Concat(acronyms).ToArray()),
|
||||||
|
RegexOptions.Compiled);
|
||||||
|
}
|
||||||
|
|
||||||
#region internal StreamReader OpenSpecFile(string file)
|
#region internal StreamReader OpenSpecFile(string file)
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace Bind
|
||||||
private DelegateCollection ReadDelegates(XPathNavigator specs)
|
private DelegateCollection ReadDelegates(XPathNavigator specs)
|
||||||
{
|
{
|
||||||
DelegateCollection delegates = new DelegateCollection();
|
DelegateCollection delegates = new DelegateCollection();
|
||||||
|
var extensions = new List<string>();
|
||||||
|
|
||||||
foreach (XPathNavigator node in specs.SelectChildren("function", String.Empty))
|
foreach (XPathNavigator node in specs.SelectChildren("function", String.Empty))
|
||||||
{
|
{
|
||||||
|
@ -78,6 +79,9 @@ namespace Bind
|
||||||
d.Category = node.GetAttribute("category", String.Empty);
|
d.Category = node.GetAttribute("category", String.Empty);
|
||||||
d.DeprecatedVersion = node.GetAttribute("deprecated", String.Empty);
|
d.DeprecatedVersion = node.GetAttribute("deprecated", String.Empty);
|
||||||
d.Deprecated = !String.IsNullOrEmpty(d.DeprecatedVersion);
|
d.Deprecated = !String.IsNullOrEmpty(d.DeprecatedVersion);
|
||||||
|
d.Extension = node.GetAttribute("extension", String.Empty) ?? "Core";
|
||||||
|
if (!extensions.Contains(d.Extension))
|
||||||
|
extensions.Add(d.Extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
|
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
|
||||||
|
@ -117,6 +121,7 @@ namespace Bind
|
||||||
delegates.Add(d);
|
delegates.Add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utilities.InitExtensions(extensions);
|
||||||
return delegates;
|
return delegates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue