public IEnumerable <IFeature> AllFeatures(RegistryContext ctx) { foreach (Feature feature in Features) { if (ctx.IsSupportedApi(feature.Api)) { yield return(feature); } } List <Extension> extensions = new List <Extension>(Extensions); extensions.RemoveAll(delegate(Extension item) { return(item.Supported != null && !ctx.IsSupportedApi(item.Supported)); }); extensions.Sort(delegate(Extension x, Extension y) { int xIndex = ExtensionIndices.GetIndex(x.Name); int yIndex = ExtensionIndices.GetIndex(y.Name); if (xIndex != yIndex) { return(xIndex.CompareTo(yIndex)); } else { return(x.Name.CompareTo(y.Name)); } }); foreach (Extension extension in extensions) { yield return(extension); } }
static ExtensionIndices() { // Load extension indices using (Stream sr = Assembly.GetExecutingAssembly().GetManifestResourceStream("BindingsGen.GLSpecs.ExtIndices.xml")) { XmlSerializer serializer = new XmlSerializer(typeof(ExtensionIndices)); sExtensionIndices = (ExtensionIndices)serializer.Deserialize(sr); } // Build map foreach (Index index in sExtensionIndices.Indices) { string extension = index.Extension.Trim(); if (!Extension.IsArbVendor(extension)) continue; foreach (string extensionItem in Regex.Split(extension, " ")) { sExtensionIndices.mIndicesMap.Add(extensionItem, index.IndexValue); } } // Build map sVendorExtensionIndices = new ExtensionIndices(); foreach (Index index in sExtensionIndices.Indices) { string extension = index.Extension.Trim(); if (Extension.IsArbVendor(extension)) continue; foreach (string extensionItem in Regex.Split(extension, " ")) { sVendorExtensionIndices.mIndicesMap.Add(extensionItem, index.IndexValue); } } }
static ExtensionIndices() { // Load extension indices using (Stream sr = Assembly.GetExecutingAssembly().GetManifestResourceStream("BindingsGen.GLSpecs.ExtIndices.xml")) { XmlSerializer serializer = new XmlSerializer(typeof(ExtensionIndices)); sExtensionIndices = (ExtensionIndices)serializer.Deserialize(sr); } // Build map foreach (Index index in sExtensionIndices.Indices) { string extension = index.Extension.Trim(); if (!Extension.IsArbVendor(extension)) { continue; } foreach (string extensionItem in Regex.Split(extension, " ")) { sExtensionIndices.mIndicesMap.Add(extensionItem, index.IndexValue); } } // Build map sVendorExtensionIndices = new ExtensionIndices(); foreach (Index index in sExtensionIndices.Indices) { string extension = index.Extension.Trim(); if (Extension.IsArbVendor(extension)) { continue; } foreach (string extensionItem in Regex.Split(extension, " ")) { sVendorExtensionIndices.mIndicesMap.Add(extensionItem, index.IndexValue); } } }
public IEnumerable <IFeature> AllFeatures(RegistryContext ctx) { List <Feature> features = Features.FindAll(delegate(Feature item) { return(ctx.IsSupportedApi(item.Api)); }); features.Sort(delegate(Feature x, Feature y) { OpenGL.KhronosVersion xVersion = OpenGL.KhronosVersion.ParseFeature(x.Name, false); OpenGL.KhronosVersion yVersion = OpenGL.KhronosVersion.ParseFeature(y.Name, false); if (xVersion.Api != yVersion.Api) { int xPriority = GetVersionApiPriority(xVersion.Api); int yPriority = GetVersionApiPriority(yVersion.Api); if (xPriority != yPriority) { return(xPriority.CompareTo(yPriority)); } else { return(x.Name.CompareTo(y.Name)); } } else { return(xVersion.CompareTo(yVersion)); } }); foreach (Feature feature in features) { yield return(feature); } List <Extension> extensions = new List <Extension>(Extensions); extensions.RemoveAll(delegate(Extension item) { return(item.Supported != null && !ctx.IsSupportedApi(item.Supported)); }); extensions.Sort(delegate(Extension x, Extension y) { int xVendor = GetExtensionVendorPriority(x.Vendor), yVendor = GetExtensionVendorPriority(y.Vendor); if (xVendor != yVendor) { return(GetExtensionVendorPriority(x.Vendor).CompareTo(GetExtensionVendorPriority(y.Vendor))); } int xIndex = ExtensionIndices.GetIndex(x.Name); int yIndex = ExtensionIndices.GetIndex(y.Name); if (xIndex != yIndex) { return(xIndex.CompareTo(yIndex)); } else { return(x.Name.CompareTo(y.Name)); } }); foreach (Extension extension in extensions) { yield return(extension); } }