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); } }
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); } }