mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 07:45:37 +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.IO;
|
||||
using System.Xml.XPath;
|
||||
|
@ -11,8 +11,8 @@ namespace Bind.CL
|
|||
{
|
||||
class CLGenerator : ES.ESGenerator
|
||||
{
|
||||
public CLGenerator(Settings settings, string name, string dirname)
|
||||
: base(settings, name, dirname)
|
||||
public CLGenerator(Settings settings, string dirname)
|
||||
: base(settings, dirname)
|
||||
{
|
||||
glTypemap = null;
|
||||
|
||||
|
@ -23,10 +23,14 @@ namespace Bind.CL
|
|||
Settings.EnumPrefix = "Cl";
|
||||
|
||||
Settings.OutputClass = "CL";
|
||||
Settings.OutputNamespace = "OpenTK.Compute." + name;
|
||||
|
||||
//Settings.Compatibility &= ~Settings.Legacy.TurnVoidPointersToIntPtr;
|
||||
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
|
||||
{
|
||||
// Generator implementation for OpenGL ES 1.0 and 1.1
|
||||
class ESGenerator : Generator
|
||||
{
|
||||
public ESGenerator(Settings settings, string nsName, string dirName)
|
||||
: base(settings, nsName, dirName)
|
||||
public ESGenerator(Settings settings, string dirName)
|
||||
: base(settings, dirName)
|
||||
{
|
||||
Settings.ImportsFile = nsName + "Core.cs";
|
||||
Settings.DelegatesFile = nsName + "Delegates.cs";
|
||||
Settings.EnumsFile = nsName + "Enums.cs";
|
||||
Settings.WrappersFile = nsName + ".cs";
|
||||
Settings.DefaultOutputNamespace = "OpenTK.Graphics.ES11";
|
||||
Settings.DefaultImportsFile = "ES11Core.cs";
|
||||
Settings.DefaultDelegatesFile = "ES11Delegates.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
|
||||
{
|
||||
public GL4Generator(Settings settings, string name, string dirname)
|
||||
: base(settings, name, dirname)
|
||||
public GL4Generator(Settings settings, string dirname)
|
||||
: base(settings, dirname)
|
||||
{
|
||||
Settings.ImportsFile = "GL4Core.cs";
|
||||
Settings.DelegatesFile = "GL4Delegates.cs";
|
||||
Settings.EnumsFile = "GL4Enums.cs";
|
||||
Settings.WrappersFile = "GL4.cs";
|
||||
Settings.DefaultOutputNamespace = "OpenTK.Graphics.OpenGL4";
|
||||
Settings.DefaultImportsFile = "GL4Core.cs";
|
||||
Settings.DefaultDelegatesFile = "GL4Delegates.cs";
|
||||
Settings.DefaultEnumsFile = "GL4Enums.cs";
|
||||
Settings.DefaultWrappersFile = "GL4.cs";
|
||||
|
||||
Profile = "glcore";
|
||||
}
|
||||
|
|
|
@ -37,19 +37,33 @@ namespace Bind.GL2
|
|||
//protected static readonly Dictionary<string, string> doc_replacements;
|
||||
|
||||
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";
|
||||
|
||||
/// <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; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public Generator(Settings settings, string nsName, string dirName)
|
||||
public Generator(Settings settings, string dirName)
|
||||
{
|
||||
if (settings == null)
|
||||
throw new ArgumentNullException("settings");
|
||||
if (String.IsNullOrEmpty(nsName))
|
||||
throw new ArgumentNullException("nsName");
|
||||
if (dirName == null)
|
||||
dirName = "GL2";
|
||||
|
||||
|
@ -67,7 +81,6 @@ namespace Bind.GL2
|
|||
Settings.ImportsClass = "Core";
|
||||
Settings.DelegatesClass = "Delegates";
|
||||
Settings.OutputClass = "GL";
|
||||
Settings.OutputNamespace = nsName;
|
||||
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
|
@ -79,10 +92,11 @@ namespace Bind.GL2
|
|||
// Defaults
|
||||
}
|
||||
|
||||
Settings.ImportsFile = "GLCore.cs";
|
||||
Settings.DelegatesFile = "GLDelegates.cs";
|
||||
Settings.EnumsFile = "GLEnums.cs";
|
||||
Settings.WrappersFile = "GL.cs";
|
||||
Settings.DefaultOutputNamespace = "OpenTK.Graphics.OpenGL";
|
||||
Settings.DefaultImportsFile = "GLCore.cs";
|
||||
Settings.DefaultDelegatesFile = "GLDelegates.cs";
|
||||
Settings.DefaultEnumsFile = "GLEnums.cs";
|
||||
Settings.DefaultWrappersFile = "GL.cs";
|
||||
|
||||
Delegates = new DelegateCollection();
|
||||
Enums = new EnumCollection();
|
||||
|
@ -108,16 +122,16 @@ namespace Bind.GL2
|
|||
GLTypes = SpecReader.ReadTypeMap(Path.Combine(Settings.InputPath, glTypemap));
|
||||
CSTypes = SpecReader.ReadCSTypeMap(Path.Combine(Settings.InputPath, csTypemap));
|
||||
|
||||
SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile);
|
||||
SpecReader.ReadEnums(overrides, Enums, "");
|
||||
SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile);
|
||||
SpecReader.ReadDelegates(overrides, Delegates, "");
|
||||
SpecReader.ReadEnums(Path.Combine(Settings.InputPath, enumSpec), Enums, Profile, Version);
|
||||
SpecReader.ReadEnums(overrides, Enums, Profile, Version);
|
||||
SpecReader.ReadDelegates(Path.Combine(Settings.InputPath, glSpec), Delegates, Profile, Version);
|
||||
SpecReader.ReadDelegates(overrides, Delegates, Profile, Version);
|
||||
|
||||
var enum_processor = new EnumProcessor(this, overrides);
|
||||
var func_processor = new FuncProcessor(this, overrides);
|
||||
|
||||
Enums = enum_processor.Process(Enums);
|
||||
Wrappers = func_processor.Process(enum_processor, Delegates, Enums);
|
||||
Enums = enum_processor.Process(Enums, Profile);
|
||||
Wrappers = func_processor.Process(enum_processor, Delegates, Enums, Profile);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue