mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 16:15:34 +00:00
Do not override user defined output files
The generator will now change the default output files to match its bindings (e.g. GL vs ES), but the user is now able to override this option.
This commit is contained in:
parent
5ab8b451c9
commit
e8f46c87f6
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
|
@ -11,8 +11,8 @@ namespace Bind.CL
|
||||||
{
|
{
|
||||||
class CLGenerator : ES.ESGenerator
|
class CLGenerator : ES.ESGenerator
|
||||||
{
|
{
|
||||||
public CLGenerator(Settings settings, string name, string dirname)
|
public CLGenerator(Settings settings, string dirname)
|
||||||
: base(settings, name, dirname)
|
: base(settings, dirname)
|
||||||
{
|
{
|
||||||
glTypemap = null;
|
glTypemap = null;
|
||||||
|
|
||||||
|
@ -23,10 +23,14 @@ namespace Bind.CL
|
||||||
Settings.EnumPrefix = "Cl";
|
Settings.EnumPrefix = "Cl";
|
||||||
|
|
||||||
Settings.OutputClass = "CL";
|
Settings.OutputClass = "CL";
|
||||||
Settings.OutputNamespace = "OpenTK.Compute." + name;
|
|
||||||
|
|
||||||
//Settings.Compatibility &= ~Settings.Legacy.TurnVoidPointersToIntPtr;
|
//Settings.Compatibility &= ~Settings.Legacy.TurnVoidPointersToIntPtr;
|
||||||
Settings.Compatibility |= Settings.Legacy.NoDebugHelpers;
|
Settings.Compatibility |= Settings.Legacy.NoDebugHelpers;
|
||||||
|
|
||||||
|
Settings.DefaultImportsFile = "CLCore.cs";
|
||||||
|
Settings.DefaultDelegatesFile = "CLDelegates.cs";
|
||||||
|
Settings.DefaultEnumsFile = "CLEnums.cs";
|
||||||
|
Settings.DefaultWrappersFile = "CL.cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,23 @@ using Enum=Bind.Structures.Enum;
|
||||||
|
|
||||||
namespace Bind.ES
|
namespace Bind.ES
|
||||||
{
|
{
|
||||||
|
// Generator implementation for OpenGL ES 1.0 and 1.1
|
||||||
class ESGenerator : Generator
|
class ESGenerator : Generator
|
||||||
{
|
{
|
||||||
public ESGenerator(Settings settings, string nsName, string dirName)
|
public ESGenerator(Settings settings, string dirName)
|
||||||
: base(settings, nsName, dirName)
|
: base(settings, dirName)
|
||||||
{
|
{
|
||||||
Settings.ImportsFile = nsName + "Core.cs";
|
Settings.DefaultOutputNamespace = "OpenTK.Graphics.ES11";
|
||||||
Settings.DelegatesFile = nsName + "Delegates.cs";
|
Settings.DefaultImportsFile = "ES11Core.cs";
|
||||||
Settings.EnumsFile = nsName + "Enums.cs";
|
Settings.DefaultDelegatesFile = "ES11Delegates.cs";
|
||||||
Settings.WrappersFile = nsName + ".cs";
|
Settings.DefaultEnumsFile = "ES11Enums.cs";
|
||||||
|
Settings.DefaultWrappersFile = "ES11.cs";
|
||||||
|
|
||||||
|
// Khronos releases a combined 1.0+1.1 specification,
|
||||||
|
// so we cannot distinguish between the two.
|
||||||
|
// Todo: add support for common and light profiles.
|
||||||
|
Profile = "gles1";
|
||||||
|
Version = "1.1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,14 @@ namespace Bind.GL2
|
||||||
{
|
{
|
||||||
class GL4Generator : Generator
|
class GL4Generator : Generator
|
||||||
{
|
{
|
||||||
public GL4Generator(Settings settings, string name, string dirname)
|
public GL4Generator(Settings settings, string dirname)
|
||||||
: base(settings, name, dirname)
|
: base(settings, dirname)
|
||||||
{
|
{
|
||||||
Settings.ImportsFile = "GL4Core.cs";
|
Settings.DefaultOutputNamespace = "OpenTK.Graphics.OpenGL4";
|
||||||
Settings.DelegatesFile = "GL4Delegates.cs";
|
Settings.DefaultImportsFile = "GL4Core.cs";
|
||||||
Settings.EnumsFile = "GL4Enums.cs";
|
Settings.DefaultDelegatesFile = "GL4Delegates.cs";
|
||||||
Settings.WrappersFile = "GL4.cs";
|
Settings.DefaultEnumsFile = "GL4Enums.cs";
|
||||||
|
Settings.DefaultWrappersFile = "GL4.cs";
|
||||||
|
|
||||||
Profile = "glcore";
|
Profile = "glcore";
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,19 +37,33 @@ namespace Bind.GL2
|
||||||
//protected static readonly Dictionary<string, string> doc_replacements;
|
//protected static readonly Dictionary<string, string> doc_replacements;
|
||||||
|
|
||||||
protected ISpecReader SpecReader { get; set; }
|
protected ISpecReader SpecReader { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Profile field corresponds to the "profile" attribute
|
||||||
|
/// in the OpenGL registry. We use this to distinguish between
|
||||||
|
/// different profiles (e.g. "gl", "glcore", "gles1", "gles2").
|
||||||
|
/// </summary>
|
||||||
protected string Profile = "gl";
|
protected string Profile = "gl";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Version field corresponds to the "number" attribute
|
||||||
|
/// in the OpenGL registry. We use this to distinguish between
|
||||||
|
/// OpenGL ES 2.0 and 3.0, which share the same profile "gles2".
|
||||||
|
/// If empty, then all elements of a profile will be parsed, and
|
||||||
|
/// their version number will be ignored.
|
||||||
|
/// </summary>
|
||||||
|
protected string Version = String.Empty;
|
||||||
|
|
||||||
public Settings Settings { get; protected set; }
|
public Settings Settings { get; protected set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public Generator(Settings settings, string nsName, string dirName)
|
public Generator(Settings settings, string dirName)
|
||||||
{
|
{
|
||||||
if (settings == null)
|
if (settings == null)
|
||||||
throw new ArgumentNullException("settings");
|
throw new ArgumentNullException("settings");
|
||||||
if (String.IsNullOrEmpty(nsName))
|
|
||||||
throw new ArgumentNullException("nsName");
|
|
||||||
if (dirName == null)
|
if (dirName == null)
|
||||||
dirName = "GL2";
|
dirName = "GL2";
|
||||||
|
|
||||||
|
@ -67,7 +81,6 @@ namespace Bind.GL2
|
||||||
Settings.ImportsClass = "Core";
|
Settings.ImportsClass = "Core";
|
||||||
Settings.DelegatesClass = "Delegates";
|
Settings.DelegatesClass = "Delegates";
|
||||||
Settings.OutputClass = "GL";
|
Settings.OutputClass = "GL";
|
||||||
Settings.OutputNamespace = nsName;
|
|
||||||
|
|
||||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||||
{
|
{
|
||||||
|
@ -79,10 +92,11 @@ namespace Bind.GL2
|
||||||
// Defaults
|
// Defaults
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.ImportsFile = "GLCore.cs";
|
Settings.DefaultOutputNamespace = "OpenTK.Graphics.OpenGL";
|
||||||
Settings.DelegatesFile = "GLDelegates.cs";
|
Settings.DefaultImportsFile = "GLCore.cs";
|
||||||
Settings.EnumsFile = "GLEnums.cs";
|
Settings.DefaultDelegatesFile = "GLDelegates.cs";
|
||||||
Settings.WrappersFile = "GL.cs";
|
Settings.DefaultEnumsFile = "GLEnums.cs";
|
||||||
|
Settings.DefaultWrappersFile = "GL.cs";
|
||||||
|
|
||||||
Delegates = new DelegateCollection();
|
Delegates = new DelegateCollection();
|
||||||
Enums = new EnumCollection();
|
Enums = new EnumCollection();
|
||||||
|
@ -108,16 +122,16 @@ namespace Bind.GL2
|
||||||
GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
|
GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
|
||||||
CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
|
CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
|
||||||
|
|
||||||
SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile);
|
SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
|
||||||
SpecReader.ReadEnums(overrides, Enums, "");
|
SpecReader.ReadEnums(overrides, Enums, Profile, Version);
|
||||||
SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile);
|
SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
|
||||||
SpecReader.ReadDelegates(overrides, Delegates, "");
|
SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);
|
||||||
|
|
||||||
var enum_processor = new EnumProcessor(this, overrides);
|
var enum_processor = new EnumProcessor(this, overrides);
|
||||||
var func_processor = new FuncProcessor(this, overrides);
|
var func_processor = new FuncProcessor(this, overrides);
|
||||||
|
|
||||||
Enums = enum_processor.Process(Enums);
|
Enums = enum_processor.Process(Enums, Profile);
|
||||||
Wrappers = func_processor.Process(enum_processor, Delegates, Enums);
|
Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue