Merge pull request #228 from Frassle/spec
Clean up binding converter and generator
This commit is contained in:
commit
f3b30044d3
30 changed files with 106856 additions and 13628 deletions
|
@ -39,7 +39,7 @@ namespace Bind
|
|||
using Enum = Bind.Structures.Enum;
|
||||
using Type = Bind.Structures.Type;
|
||||
|
||||
sealed class CSharpSpecWriter : ISpecWriter
|
||||
sealed class CSharpSpecWriter
|
||||
{
|
||||
IBind Generator { get; set; }
|
||||
Settings Settings { get { return Generator.Settings; } }
|
||||
|
|
|
@ -1,732 +0,0 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2010 the Open Toolkit library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
using Delegate = Bind.Structures.Delegate;
|
||||
using Enum = Bind.Structures.Enum;
|
||||
using Type = Bind.Structures.Type;
|
||||
|
||||
sealed class CppSpecWriter : ISpecWriter
|
||||
{
|
||||
const string AllowDeprecated = "GLPP_COMPATIBLE";
|
||||
const string DigitPrefix = "T"; // Prefix for identifiers that start with a digit
|
||||
const string OutputFileHeader = "gl++.h";
|
||||
|
||||
IBind Generator { get; set; }
|
||||
Settings Settings { get { return Generator.Settings; } }
|
||||
|
||||
#region Verbatim parts of output file
|
||||
|
||||
const string GetAddressDefinition = @"
|
||||
namespace Internals
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
extern ""C""
|
||||
{
|
||||
#define GLPP_APIENTRY __stdcall
|
||||
typedef int (*PROC)();
|
||||
extern void* __stdcall wglGetCurrentContext();
|
||||
extern PROC __stdcall wglGetProcAddress(const char *procname);
|
||||
extern void* __stdcall LoadLibraryA(const char *libname);
|
||||
extern PROC __stdcall GetProcAddress(void *module, const char *procname);
|
||||
}
|
||||
inline void*& LoadGLAddress()
|
||||
{
|
||||
static void* address = LoadLibraryA(""opengl32.dll"");
|
||||
return address;
|
||||
}
|
||||
inline void*& GetGLAddress()
|
||||
{
|
||||
static void* address = LoadGLAddress();
|
||||
return address;
|
||||
}
|
||||
inline PROC winGetAddress(const char *procname)
|
||||
{
|
||||
PROC addr = GetProcAddress(GetGLAddress(), procname);
|
||||
return addr ? addr : wglGetProcAddress(procname);
|
||||
}
|
||||
|
||||
#elif !defined(__APPLE__)
|
||||
extern ""C""
|
||||
{
|
||||
#define GLPP_APIENTRY
|
||||
extern void* glXGetCurrentContext();
|
||||
extern void (*glXGetProcAddress(const char *procname))();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define GLPP_APIENTRY
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
extern ""C"" void* CGLGetCurrentContext();
|
||||
|
||||
#ifdef MAC_OS_X_VERSION_10_3
|
||||
#include <dlfcn.h>
|
||||
inline void* NSGLGetProcAddress(const char *name)
|
||||
{
|
||||
static void* image = NULL;
|
||||
if (NULL == image)
|
||||
{
|
||||
image = dlopen(""/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"", RTLD_LAZY);
|
||||
}
|
||||
return image ? dlsym(image, (const char*)name) : NULL;
|
||||
}
|
||||
#else
|
||||
#include <mach-o/dyld.h>
|
||||
inline void* NSGLGetProcAddress(const char *name)
|
||||
{
|
||||
static const struct mach_header* image = NULL;
|
||||
NSSymbol symbol;
|
||||
char* symbolName;
|
||||
if (NULL == image)
|
||||
{
|
||||
image = NSAddImage(""/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
}
|
||||
// prepend a '_' for the Unix C symbol mangling convention
|
||||
symbolName = malloc(strlen((const char*)name) + 2);
|
||||
strcpy(symbolName+1, (const char*)name);
|
||||
symbolName[0] = '_';
|
||||
symbol = NULL;
|
||||
symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL;
|
||||
free(symbolName);
|
||||
return symbol ? NSAddressOfSymbol(symbol) : NULL;
|
||||
}
|
||||
#endif /* MAC_OS_X_VERSION_10_3 */
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#if defined(__sgi) || defined (__sun)
|
||||
#define GLPP_APIENTRY
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
inline void* LoadSymbol(const char *name)
|
||||
{
|
||||
// dlopen what?
|
||||
if ((void *h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
|
||||
return dlsym(h, ""glXGetProcAddress"");
|
||||
}
|
||||
inline void* dlGetProcAddress(const char *name)
|
||||
{
|
||||
static void* gpa = LoadSymbol(""glXGetProcAddress"");
|
||||
|
||||
if (gpa != NULL)
|
||||
return ((void*(*)(const char*))gpa)(name);
|
||||
else
|
||||
return dlsym(h, (const char*)name);
|
||||
}
|
||||
inline void* dlGetCurrentContext()
|
||||
{
|
||||
static void* gpa = LoadSymbol(""glXGetProcAddress"");
|
||||
|
||||
if (gpa != NULL)
|
||||
return ((void*(*)())gpa)();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* __sgi || __sun */
|
||||
|
||||
inline void* GetAddress(const char* name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return (void*)winGetAddress(name);
|
||||
#elif defined(__APPLE__)
|
||||
return (void*)NSGLGetProcAddress(name);
|
||||
#elif defined(__sgi) || defined(__sun)
|
||||
return (void*)dlGetProcAddress(name);
|
||||
#else
|
||||
return (void*)glXGetProcAddress((const char*)name);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void* GetCurrentContext()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return wglGetCurrentContext();
|
||||
#elif defined(__APPLE__)
|
||||
return CGLGetCurrentContext();
|
||||
#elif defined(__sgi) || defined(__sun)
|
||||
return dlGetCurrentContext();
|
||||
#else
|
||||
return glXGetCurrentContext();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
const string TypeDefinitions = @"
|
||||
template<typename T>
|
||||
struct Enumeration
|
||||
{
|
||||
private:
|
||||
int value;
|
||||
|
||||
public:
|
||||
inline Enumeration(int value)
|
||||
{
|
||||
this->value = value;
|
||||
}
|
||||
|
||||
inline operator int() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef int GLsizei; // size_t
|
||||
typedef bool GLboolean;
|
||||
typedef signed char GLbyte;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef short GLshort;
|
||||
typedef unsigned short GLushort;
|
||||
typedef int GLint;
|
||||
typedef unsigned int GLuint;
|
||||
typedef long GLlong;
|
||||
typedef unsigned long GLulong;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef void GLvoid;
|
||||
typedef GLint* GLintptr;
|
||||
typedef GLsizei* GLsizeiptr;
|
||||
|
||||
typedef const char* GLstring;
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1400
|
||||
typedef __int64 GLint64EXT;
|
||||
typedef unsigned __int64 GLuint64EXT;
|
||||
#else
|
||||
typedef signed long long GLint64EXT;
|
||||
typedef unsigned long long GLuint64EXT;
|
||||
#endif
|
||||
typedef GLint64EXT GLint64;
|
||||
typedef GLuint64EXT GLuint64;
|
||||
typedef struct __GLsync { } *GLsync;
|
||||
typedef struct __GLhandleARB { } *GLhandleARB;
|
||||
typedef GLintptr GLintptrARB;
|
||||
typedef GLsizeiptr GLsizeiptrARB;
|
||||
|
||||
typedef char GLchar;
|
||||
typedef void (*GLDEBUGPROCAMD)(GLuint id,
|
||||
GLenum category, GLenum severity, GLsizei length,
|
||||
const GLchar* message, GLvoid* userParam);
|
||||
|
||||
/* For ARB_debug_output */
|
||||
|
||||
typedef void (*GLDEBUGPROCARB)(GLenum source,
|
||||
GLenum type, GLuint id, GLenum severity,
|
||||
GLsizei length, const GLchar* message, GLvoid* userParam);
|
||||
|
||||
/* For GL_ARB_cl_event */
|
||||
|
||||
typedef struct cl_context *_cl_context;
|
||||
typedef struct cl_event *_cl_event;
|
||||
|
||||
//typedef GLsizei IntPtr;
|
||||
typedef void* IntPtr;
|
||||
typedef GLbyte SByte;
|
||||
typedef GLubyte Byte;
|
||||
typedef GLshort Int16;
|
||||
typedef GLushort UInt16;
|
||||
typedef GLint Int32;
|
||||
typedef GLuint UInt32;
|
||||
typedef GLlong Int64;
|
||||
typedef GLulong UInt64;
|
||||
typedef GLfloat Single;
|
||||
typedef GLdouble Double;
|
||||
typedef GLstring String;
|
||||
typedef char* StringBuilder;
|
||||
typedef GLDEBUGPROCAMD DebugProcAmd;
|
||||
typedef GLDEBUGPROCARB DebugProcArb;
|
||||
typedef struct _GLvdpauSurfaceNV *GLvdpauSurfaceNV;
|
||||
|
||||
struct Half
|
||||
{
|
||||
private:
|
||||
GLushort value;
|
||||
public:
|
||||
};
|
||||
typedef Half GLhalf;
|
||||
typedef GLhalf GLhalfNV;
|
||||
";
|
||||
|
||||
#endregion
|
||||
|
||||
BindStreamWriter sw_h = new BindStreamWriter(Path.GetTempFileName());
|
||||
|
||||
#region WriteBindings
|
||||
|
||||
public void WriteBindings(IBind generator)
|
||||
{
|
||||
Generator = generator;
|
||||
WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums);
|
||||
}
|
||||
|
||||
void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
|
||||
{
|
||||
Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
// Hack: Fix 3dfx extension category so it doesn't start with a digit
|
||||
if (wrappers.ContainsKey("3dfx"))
|
||||
{
|
||||
var three_dee_fx = wrappers["3dfx"];
|
||||
wrappers.Remove("3dfx");
|
||||
wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
|
||||
}
|
||||
|
||||
Settings.DefaultOutputNamespace = "OpenTK";
|
||||
|
||||
using (var sw = sw_h)
|
||||
{
|
||||
sw.WriteLine("#pragma once");
|
||||
sw.WriteLine("#ifndef GLPP_H");
|
||||
sw.WriteLine("#define GLPP_H");
|
||||
sw.WriteLine();
|
||||
|
||||
WriteLicense(sw);
|
||||
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
WriteGetAddress(sw);
|
||||
WriteTypes(sw);
|
||||
WriteEnums(sw, enums);
|
||||
WriteDefinitions(sw, enums, wrappers, Generator.CSTypes); // Core definitions
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
||||
sw.WriteLine("#endif");
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
|
||||
Move(sw_h.File, output_header);
|
||||
}
|
||||
|
||||
void Move(string file, string dest)
|
||||
{
|
||||
if (File.Exists(dest))
|
||||
File.Delete(dest);
|
||||
File.Move(file, dest);
|
||||
}
|
||||
|
||||
static Delegate WriteWrapper(Delegate last_delegate, Function f, BindStreamWriter sw)
|
||||
{
|
||||
//if (last_delegate == f.WrappedDelegate)
|
||||
// return last_delegate; // Multiple wrappers for the same delegate are not necessary in C++
|
||||
|
||||
var valid = true;
|
||||
var parameters = GenerateParameterString(f, true, out valid);
|
||||
if (!valid)
|
||||
return last_delegate;
|
||||
|
||||
last_delegate = f.WrappedDelegate;
|
||||
|
||||
sw.WriteLine("inline {0} {1}({2})", f.WrappedDelegate.ReturnType,
|
||||
f.TrimmedName, parameters);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
WriteMethodBody(sw, f);
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
return last_delegate;
|
||||
}
|
||||
|
||||
static string GenerateParameterString(Delegate d, bool check_validity, out bool valid)
|
||||
{
|
||||
if (d == null)
|
||||
throw new ArgumentNullException("d");
|
||||
|
||||
valid = true;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if (d.Parameters.Count > 0)
|
||||
{
|
||||
foreach (var p in d.Parameters)
|
||||
{
|
||||
if (p.CurrentType.ToLower() == "string[]")
|
||||
p.CurrentType = "char**";
|
||||
if (p.CurrentType.ToLower() == "string")
|
||||
p.CurrentType = "char*";
|
||||
|
||||
if (p.Reference)
|
||||
{
|
||||
if (/*check_validity &&*/ p.Generic)
|
||||
{
|
||||
// We don't need generic parameters in C++ and void& is illegal.
|
||||
valid = false;
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
if (p.Flow != FlowDirection.Out)
|
||||
sb.Append("const ");
|
||||
sb.Append(p.QualifiedType);
|
||||
sb.Append('*', p.Array);
|
||||
sb.Append("&");
|
||||
}
|
||||
else if (p.Array > 0)
|
||||
{
|
||||
// Hack: generic parameters with array types are
|
||||
// not real (i.e. they are created by the generator
|
||||
// specifically for managed languages). We don't
|
||||
// need them in C++.
|
||||
// Todo: move C#/Java-specific code to their respective
|
||||
// classes, instead of the main generator.
|
||||
// Note: the 1-dimensional array is handled through the pointer case below.
|
||||
// (C# differentiates between arrays and pointers, C++ doesn't).
|
||||
if (check_validity && (p.Generic || p.Array == 1))
|
||||
{
|
||||
valid = false;
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
if (p.Flow != FlowDirection.Out)
|
||||
sb.Append("const ");
|
||||
sb.Append(p.Generic ? "void" : p.QualifiedType); // We don't need generic parameters in C++.
|
||||
sb.Append('*', p.Array);
|
||||
}
|
||||
else if (p.Pointer > 0)
|
||||
{
|
||||
if (p.Flow != FlowDirection.Out)
|
||||
sb.Append("const ");
|
||||
sb.Append(p.Generic ? "void" : p.QualifiedType); // We don't need generic parameters in C++.
|
||||
sb.Append('*', p.Pointer);
|
||||
}
|
||||
else if (p.CurrentType == "IntPtr")
|
||||
{
|
||||
if (p.Flow != FlowDirection.Out)
|
||||
sb.Append("const ");
|
||||
sb.Append("void*");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(p.QualifiedType);
|
||||
}
|
||||
|
||||
sb.Append(" ");
|
||||
sb.Append(p.Name);
|
||||
sb.Append(", ");
|
||||
}
|
||||
|
||||
if (d.Parameters.Count > 0)
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static Delegate WriteInitDelegate(Delegate last_delegate, BindStreamWriter sw, Function f)
|
||||
{
|
||||
if (last_delegate != f.WrappedDelegate)
|
||||
{
|
||||
sw.WriteLine("Delegates::{0}() = (Delegates::p{0})OpenTK::Internals::GetAddress(\"gl{0}\");", f.WrappedDelegate.Name);
|
||||
last_delegate = f.WrappedDelegate;
|
||||
}
|
||||
return last_delegate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteDefinitions
|
||||
|
||||
void WriteDefinitions(BindStreamWriter sw,
|
||||
EnumCollection enums, FunctionCollection wrappers,
|
||||
IDictionary<string, string> CSTypes)
|
||||
{
|
||||
sw.WriteLine("namespace {0}", Settings.GLClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
foreach (string extension in wrappers.Keys)
|
||||
{
|
||||
if (extension != "Core")
|
||||
{
|
||||
sw.WriteLine("namespace {0}", extension);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
}
|
||||
|
||||
// Avoid multiple definitions of the same function
|
||||
Delegate last_delegate = null;
|
||||
|
||||
// Write delegates
|
||||
sw.WriteLine("namespace Delegates");
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
var functions = wrappers[extension];
|
||||
last_delegate = null;
|
||||
foreach (var f in functions.Where(f => !f.Deprecated))
|
||||
{
|
||||
WriteDelegate(sw, f.WrappedDelegate, ref last_delegate);
|
||||
}
|
||||
last_delegate = null;
|
||||
sw.WriteLine("#if defined({0})", AllowDeprecated);
|
||||
foreach (var f in functions.Where(f => f.Deprecated))
|
||||
{
|
||||
WriteDelegate(sw, f.WrappedDelegate, ref last_delegate);
|
||||
}
|
||||
sw.WriteLine("#endif");
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
|
||||
// Write wrappers
|
||||
sw.WriteLine("inline void Init()");
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
last_delegate = null;
|
||||
foreach (var f in functions.Where(f => !f.Deprecated))
|
||||
{
|
||||
last_delegate = WriteInitDelegate(last_delegate, sw, f);
|
||||
}
|
||||
last_delegate = null;
|
||||
sw.WriteLine("#if defined({0})", AllowDeprecated);
|
||||
foreach (var f in functions.Where(f => f.Deprecated))
|
||||
{
|
||||
last_delegate = WriteInitDelegate(last_delegate, sw, f);
|
||||
}
|
||||
sw.WriteLine("#endif");
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
last_delegate = null;
|
||||
foreach (var f in functions.Where(f => !f.Deprecated))
|
||||
{
|
||||
last_delegate = WriteWrapper(last_delegate, f, sw);
|
||||
}
|
||||
sw.WriteLine("#if defined({0})", AllowDeprecated);
|
||||
foreach (var f in functions.Where(f => f.Deprecated))
|
||||
{
|
||||
last_delegate = WriteWrapper(last_delegate, f, sw);
|
||||
}
|
||||
sw.WriteLine("#endif");
|
||||
|
||||
if (extension != "Core")
|
||||
{
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
}
|
||||
}
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
string GetNamespace(string ext)
|
||||
{
|
||||
if (ext == "Core")
|
||||
return Settings.GLClass;
|
||||
else
|
||||
return String.Format("{0}::{1}", Settings.GLClass, Char.IsDigit(ext[0]) ? DigitPrefix + ext : ext);
|
||||
}
|
||||
|
||||
#region WriteEnums
|
||||
|
||||
public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
|
||||
{
|
||||
foreach (Enum @enum in enums.Values)
|
||||
{
|
||||
sw.WriteLine("struct {0} : Enumeration<{0}>", @enum.Name);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine("inline {0}(int value) : Enumeration<{0}>(value) {{ }}", @enum.Name);
|
||||
sw.WriteLine("enum");
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
foreach (var c in @enum.ConstantCollection.Values)
|
||||
{
|
||||
sw.WriteLine(String.Format("{0} = {1}{2},",
|
||||
c.Name,
|
||||
!String.IsNullOrEmpty(c.Reference) ? (c.Reference + Settings.NamespaceSeparator) : "",
|
||||
!String.IsNullOrEmpty(c.Reference) ? c.Value : c.Value.ToLower()));
|
||||
}
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteTypes
|
||||
|
||||
void WriteTypes(BindStreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(TypeDefinitions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteGetAddress
|
||||
|
||||
void WriteGetAddress(BindStreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(GetAddressDefinition);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteDelegate
|
||||
|
||||
static void WriteDelegate(BindStreamWriter sw, Delegate d, ref Delegate last_delegate)
|
||||
{
|
||||
// Avoid multiple definitions of the same function
|
||||
if (d != last_delegate)
|
||||
{
|
||||
last_delegate = d;
|
||||
bool valid = true;
|
||||
var parameters = GenerateParameterString(d, false, out valid);
|
||||
sw.WriteLine("typedef {0} (GLPP_APIENTRY *p{1})({2});", d.ReturnType, d.Name, parameters);
|
||||
sw.WriteLine("inline p{0}& {0}()", d.Name);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine("static p{0} address = 0;", d.Name);
|
||||
sw.WriteLine("return address;");
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteWrappers
|
||||
|
||||
static void WriteMethodBody(BindStreamWriter sw, Function f)
|
||||
{
|
||||
//var callstring = f.Parameters.CallString()
|
||||
// .Replace("String[]", "String*");
|
||||
|
||||
var callstring = GenerateCallString(f);
|
||||
|
||||
if (f.ReturnType != null && !f.ReturnType.ToString().ToLower().Contains("void"))
|
||||
sw.Write("return ");
|
||||
sw.WriteLine("Delegates::{0}()({1});", f.WrappedDelegate.Name, callstring);
|
||||
}
|
||||
|
||||
static object GenerateCallString(Function f)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var p in f.Parameters)
|
||||
{
|
||||
if (p.Reference)
|
||||
sb.Append("&"); // Convert to pointer
|
||||
sb.Append(p.Name);
|
||||
sb.Append(", ");
|
||||
}
|
||||
if (f.Parameters.Count > 0)
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
void WriteDocumentation(BindStreamWriter sw, Function f)
|
||||
{
|
||||
var docs = f.Documentation;
|
||||
|
||||
try
|
||||
{
|
||||
string warning = "[deprecated: v{0}]";
|
||||
string category = "[requires: {0}]";
|
||||
if (f.Deprecated)
|
||||
{
|
||||
warning = String.Format(warning, f.DeprecatedVersion);
|
||||
docs.Summary = docs.Summary.Insert(0, warning);
|
||||
}
|
||||
|
||||
if (f.Extension != "Core" && !String.IsNullOrEmpty(f.Category))
|
||||
{
|
||||
category = String.Format(category, f.Category);
|
||||
docs.Summary = docs.Summary.Insert(0, category);
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(f.Version))
|
||||
{
|
||||
if (f.Category.StartsWith("VERSION"))
|
||||
category = String.Format(category, "v" + f.Version);
|
||||
else
|
||||
category = String.Format(category, "v" + f.Version + " and " + f.Category);
|
||||
docs.Summary = docs.Summary.Insert(0, category);
|
||||
}
|
||||
|
||||
for (int i = 0; i < f.WrappedDelegate.Parameters.Count; i++)
|
||||
{
|
||||
var param = f.WrappedDelegate.Parameters[i];
|
||||
if (param.ComputeSize != String.Empty)
|
||||
{
|
||||
docs.Parameters[i].Documentation.Insert(0,
|
||||
String.Format("[length: {0}]", param.ComputeSize));
|
||||
}
|
||||
}
|
||||
|
||||
sw.Write("/// \brief ");
|
||||
sw.WriteLine(docs.Summary);
|
||||
foreach (var p in docs.Parameters)
|
||||
{
|
||||
sw.Write(@"/// \param ");
|
||||
sw.Write(p.Name);
|
||||
sw.WriteLine(p.Documentation);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("[Warning] Error documenting function {0}: {1}", f.WrappedDelegate.Name, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteLicense
|
||||
|
||||
public void WriteLicense(BindStreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(File.ReadAllText(Path.Combine(Settings.InputPath, Settings.LicenseFile)));
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -155,7 +155,7 @@ namespace Bind
|
|||
if (String.IsNullOrEmpty(name))
|
||||
return name;
|
||||
|
||||
if (Utilities.Keywords(Settings.Language).Contains(name))
|
||||
if (Utilities.CSharpKeywords.Contains(name))
|
||||
return name;
|
||||
|
||||
if (!IsAlreadyProcessed(name))
|
||||
|
|
|
@ -694,7 +694,7 @@ namespace Bind
|
|||
}
|
||||
}
|
||||
|
||||
if (Utilities.Keywords(Settings.Language).Contains(p.Name))
|
||||
if (Utilities.CSharpKeywords.Contains(p.Name))
|
||||
p.Name = Settings.KeywordEscapeCharacter + p.Name;
|
||||
|
||||
// This causes problems with bool arrays
|
||||
|
|
|
@ -113,14 +113,12 @@
|
|||
<Compile Include="..\GlobalAssemblyInfo.cs">
|
||||
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="CppSpecWriter.cs" />
|
||||
<Compile Include="CSharpSpecWriter.cs" />
|
||||
<Compile Include="FuncProcessor.cs" />
|
||||
<Compile Include="GL2\GL4Generator.cs" />
|
||||
<Compile Include="IBind.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JavaSpecWriter.cs" />
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -140,9 +138,6 @@
|
|||
<Compile Include="ISpecReader.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ISpecWriter.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -180,8 +175,6 @@
|
|||
<None Include="..\..\OpenTK.snk">
|
||||
<Link>OpenTK.snk</Link>
|
||||
</None>
|
||||
<None Include="Specifications\cpp.tm" />
|
||||
<None Include="Specifications\java.tm" />
|
||||
<None Include="Specifications\GL2\gl.tm" />
|
||||
<None Include="Specifications\Glx\glx.spec">
|
||||
</None>
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
interface ISpecWriter
|
||||
{
|
||||
void WriteBindings(IBind generator);
|
||||
// void WriteDelegates(BindStreamWriter sw, DelegateCollection delegates);
|
||||
// void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers, Dictionary<string, string> CSTypes);
|
||||
// void WriteEnums(BindStreamWriter sw, EnumCollection enums);
|
||||
// void WriteTypes(BindStreamWriter sw, Dictionary<string, string> CSTypes);
|
||||
// void WriteLicense(BindStreamWriter sw);
|
||||
}
|
||||
}
|
|
@ -1,381 +0,0 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2011 the Open Toolkit library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
using Delegate = Bind.Structures.Delegate;
|
||||
using Enum = Bind.Structures.Enum;
|
||||
using Type = Bind.Structures.Type;
|
||||
|
||||
sealed class JavaSpecWriter : ISpecWriter
|
||||
{
|
||||
const string DigitPrefix = "T"; // Prefix for identifiers that start with a digit
|
||||
const string OutputFileHeader = "GL.java";
|
||||
|
||||
BindStreamWriter sw_h = new BindStreamWriter(Path.GetTempFileName());
|
||||
|
||||
IBind Generator { get; set; }
|
||||
Settings Settings { get { return Generator.Settings; } }
|
||||
|
||||
#region WriteBindings
|
||||
|
||||
public void WriteBindings(IBind generator)
|
||||
{
|
||||
Generator = generator;
|
||||
WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums);
|
||||
}
|
||||
|
||||
void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
|
||||
{
|
||||
Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
// Hack: Fix 3dfx extension category so it doesn't start with a digit
|
||||
if (wrappers.ContainsKey("3dfx"))
|
||||
{
|
||||
var three_dee_fx = wrappers["3dfx"];
|
||||
wrappers.Remove("3dfx");
|
||||
wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
|
||||
}
|
||||
|
||||
using (var sw = sw_h)
|
||||
{
|
||||
WriteLicense(sw);
|
||||
|
||||
sw.WriteLine("package {0}.{1};", Settings.OutputNamespace, Settings.GLClass);
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("import java.nio.*;");
|
||||
sw.WriteLine();
|
||||
|
||||
WriteDefinitions(sw, enums, wrappers, Generator.CSTypes);
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
|
||||
Move(sw_h.File, output_header);
|
||||
}
|
||||
|
||||
void Move(string file, string dest)
|
||||
{
|
||||
if (File.Exists(dest))
|
||||
File.Delete(dest);
|
||||
File.Move(file, dest);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteDefinitions
|
||||
|
||||
void WriteDefinitions(BindStreamWriter sw,
|
||||
EnumCollection enums, FunctionCollection wrappers,
|
||||
IDictionary<string, string> CSTypes)
|
||||
{
|
||||
sw.WriteLine("public class {0}", Settings.GLClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
foreach (string extension in wrappers.Keys)
|
||||
{
|
||||
if (extension != "Core")
|
||||
{
|
||||
sw.WriteLine("public static class {0}", extension);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
}
|
||||
|
||||
// Write wrappers
|
||||
foreach (var f in wrappers[extension])
|
||||
{
|
||||
WriteWrapper(f, sw);
|
||||
}
|
||||
|
||||
if (extension != "Core")
|
||||
{
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
}
|
||||
|
||||
WriteEnums(sw, enums);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteEnums
|
||||
|
||||
public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
|
||||
{
|
||||
foreach (Enum @enum in enums.Values)
|
||||
{
|
||||
sw.WriteLine("public enum {0}", @enum.Name);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
int count = @enum.ConstantCollection.Values.Count;
|
||||
if (count == 0)
|
||||
{
|
||||
// Java enums must have at least one value.
|
||||
sw.WriteLine("None;");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var c in @enum.ConstantCollection.Values)
|
||||
{
|
||||
sw.WriteLine(String.Format("{0}({1}{2}){3}",
|
||||
c.Name,
|
||||
!String.IsNullOrEmpty(c.Reference) ? (c.Reference + Settings.NamespaceSeparator) : "",
|
||||
!String.IsNullOrEmpty(c.Reference) ? c.Value : c.Value.ToLower(),
|
||||
--count == 0 ? ";" : ","));
|
||||
}
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("{0} mValue;", @enum.Type);
|
||||
sw.WriteLine("{0}({1} value) {{ mValue = value; }}", @enum.Name, @enum.Type);
|
||||
}
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteWrappers
|
||||
|
||||
static void WriteWrapper(Function f, BindStreamWriter sw)
|
||||
{
|
||||
var valid = true;
|
||||
var generic_parameters = GenerateGenericTypeString(f);
|
||||
var parameters = GenerateParameterString(f, out valid);
|
||||
var ret_parameter = GenerateReturnParameterString(f);
|
||||
if (!valid)
|
||||
return;
|
||||
|
||||
if (!String.IsNullOrEmpty(generic_parameters))
|
||||
sw.WriteLine("public static <{0}> {1} {2}({3})", generic_parameters,
|
||||
ret_parameter, f.TrimmedName, parameters);
|
||||
else
|
||||
sw.WriteLine("public static {0} {1}({2})", ret_parameter, f.TrimmedName,
|
||||
parameters);
|
||||
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
WriteMethodBody(sw, f);
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
static void WriteMethodBody(BindStreamWriter sw, Function f)
|
||||
{
|
||||
//var callstring = f.Parameters.CallString();
|
||||
//if (f.ReturnType != null && !f.ReturnType.ToString().ToLower().Contains("void"))
|
||||
// sw.WriteLine("return GLES20.{0}{1};", f.WrappedDelegate.Name, callstring);
|
||||
//else
|
||||
// sw.WriteLine("GLES20.{0}{1};", f.WrappedDelegate.Name, callstring);
|
||||
}
|
||||
|
||||
static string GenerateParameterString(Function f, out bool valid)
|
||||
{
|
||||
if (f == null)
|
||||
throw new ArgumentNullException("f");
|
||||
|
||||
valid = true;
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if (f.Parameters.Count > 0)
|
||||
{
|
||||
foreach (var p in f.Parameters)
|
||||
{
|
||||
if (p.Reference)
|
||||
{
|
||||
// Use a boxed type instead of primitives (i.e. "Byte" rather than "byte"), since
|
||||
// the former are reference types. We don't need to do anything for regular reference
|
||||
// types.
|
||||
// Hack: we do this by upper-casing the first letter of the type. This should work for
|
||||
// all primitive types, but won't work for enums and other reference types. In these
|
||||
// cases, we'll just ignore the reference overload.
|
||||
if (Char.IsLower(p.CurrentType[0]))
|
||||
{
|
||||
// Hack: Int -> Integer and Bool -> Boolean
|
||||
if (p.CurrentType == "int")
|
||||
sb.Append("Integer");
|
||||
else if (p.CurrentType == "bool")
|
||||
sb.Append("Boolean");
|
||||
else
|
||||
sb.Append(Char.ToUpper(p.CurrentType[0]) + p.CurrentType.Substring(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
valid = false;
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
else if (p.Array > 0)
|
||||
{
|
||||
// Generic arrays are handled in the IntPtr case below.
|
||||
if (p.Generic)
|
||||
{
|
||||
valid = false;
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
sb.Append(p.CurrentType);
|
||||
for (int i = 0; i < p.Array; i++)
|
||||
sb.Append("[]");
|
||||
}
|
||||
else if (p.Pointer > 0)
|
||||
{
|
||||
// Java does not support pointers
|
||||
// Todo: maybe use one of the java.nio.* pointer classes?
|
||||
valid = false;
|
||||
return String.Empty;
|
||||
}
|
||||
else if (p.CurrentType == "IntPtr")
|
||||
{
|
||||
sb.Append("Buffer");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(p.CurrentType);
|
||||
}
|
||||
|
||||
sb.Append(" ");
|
||||
sb.Append(p.Name);
|
||||
sb.Append(", ");
|
||||
}
|
||||
|
||||
if (f.Parameters.Count > 0)
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static string GenerateGenericTypeString(Function f)
|
||||
{
|
||||
var parameters = f.Parameters.Where(p => p.Generic);
|
||||
if (parameters.Count() > 0)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var p in f.Parameters.Where(p => p.Generic))
|
||||
{
|
||||
sb.Append(p.CurrentType);
|
||||
sb.Append(", ");
|
||||
}
|
||||
if (parameters.Count() > 0)
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
private static string GenerateReturnParameterString(Function f)
|
||||
{
|
||||
if (f.ReturnType.CurrentType == "IntPtr")
|
||||
return "Buffer";
|
||||
else
|
||||
return f.ReturnType.CurrentType;
|
||||
}
|
||||
|
||||
void WriteDocumentation(BindStreamWriter sw, Function f)
|
||||
{
|
||||
var docs = f.Documentation;
|
||||
|
||||
try
|
||||
{
|
||||
string warning = "[deprecated: v{0}]";
|
||||
string category = "[requires: {0}]";
|
||||
if (f.Deprecated)
|
||||
{
|
||||
warning = String.Format(warning, f.DeprecatedVersion);
|
||||
docs.Summary = docs.Summary.Insert(0, warning);
|
||||
}
|
||||
|
||||
if (f.Extension != "Core" && !String.IsNullOrEmpty(f.Category))
|
||||
{
|
||||
category = String.Format(category, f.Category);
|
||||
docs.Summary = docs.Summary.Insert(0, category);
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(f.Version))
|
||||
{
|
||||
if (f.Category.StartsWith("VERSION"))
|
||||
category = String.Format(category, "v" + f.Version);
|
||||
else
|
||||
category = String.Format(category, "v" + f.Version + " and " + f.Category);
|
||||
docs.Summary = docs.Summary.Insert(0, category);
|
||||
}
|
||||
|
||||
for (int i = 0; i < f.WrappedDelegate.Parameters.Count; i++)
|
||||
{
|
||||
var param = f.WrappedDelegate.Parameters[i];
|
||||
if (param.ComputeSize != String.Empty)
|
||||
{
|
||||
docs.Parameters[i].Documentation.Insert(0,
|
||||
String.Format("[length: {0}]", param.ComputeSize));
|
||||
}
|
||||
}
|
||||
|
||||
sw.WriteLine("/// <summary>{0}</summary>", docs.Summary);
|
||||
foreach (var p in docs.Parameters)
|
||||
{
|
||||
sw.WriteLine("/// <param name=\"{0}\">{1}</param>", p.Name, p.Documentation);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("[Warning] Error documenting function {0}: {1}",
|
||||
f.WrappedDelegate.Name, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteLicense
|
||||
|
||||
public void WriteLicense(BindStreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(File.ReadAllText(Path.Combine(Settings.InputPath, Settings.LicenseFile)));
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -33,13 +33,6 @@ namespace Bind
|
|||
CL10,
|
||||
}
|
||||
|
||||
enum GeneratorLanguage
|
||||
{
|
||||
CSharp,
|
||||
Cpp,
|
||||
Java
|
||||
}
|
||||
|
||||
static class MainClass
|
||||
{
|
||||
static GeneratorMode mode = GeneratorMode.Default;
|
||||
|
@ -57,7 +50,7 @@ namespace Bind
|
|||
|
||||
Console.WriteLine("OpenGL binding generator {0} for OpenTK.",
|
||||
Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net");
|
||||
Console.WriteLine("For comments, bugs and suggestions visit http://github.com/opentk/opentk");
|
||||
Console.WriteLine();
|
||||
|
||||
string dirName = "GL2";
|
||||
|
@ -87,33 +80,6 @@ namespace Bind
|
|||
case "output":
|
||||
Settings.OutputPath = val;
|
||||
break;
|
||||
case "l":
|
||||
case "lang":
|
||||
case "language":
|
||||
{
|
||||
string arg = val.ToLower();
|
||||
if (arg == "cpp" || arg == "c++" || arg == "c")
|
||||
{
|
||||
Settings.Language = GeneratorLanguage.Cpp;
|
||||
Settings.DefaultOutputPath = "gl";
|
||||
Settings.DefaultOutputNamespace = "OpenTK";
|
||||
// Settings.DefaultLanguageTypeMapFile = "cpp.tm"; // Todo: create this file!
|
||||
Settings.EnumsNamespace = "";
|
||||
Settings.NamespaceSeparator = "::";
|
||||
Settings.DefaultKeywordEscapeCharacter = "_";
|
||||
}
|
||||
else if (arg == "java")
|
||||
{
|
||||
Settings.Language = GeneratorLanguage.Java;
|
||||
Settings.DefaultOutputPath = "gl";
|
||||
Settings.DefaultOutputNamespace = "com.opentk";
|
||||
Settings.DefaultLanguageTypeMapFile = "java.tm";
|
||||
Settings.EnumsNamespace = "";
|
||||
Settings.NamespaceSeparator = ".";
|
||||
Settings.DefaultKeywordEscapeCharacter = "_";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "mode":
|
||||
{
|
||||
string arg = val.ToLower();
|
||||
|
@ -240,22 +206,7 @@ namespace Bind
|
|||
|
||||
generator.Process();
|
||||
|
||||
ISpecWriter writer = null;
|
||||
switch (generator.Settings.Language)
|
||||
{
|
||||
case GeneratorLanguage.Cpp:
|
||||
writer = new CppSpecWriter();
|
||||
break;
|
||||
|
||||
case GeneratorLanguage.Java:
|
||||
writer = new JavaSpecWriter();
|
||||
break;
|
||||
|
||||
case GeneratorLanguage.CSharp:
|
||||
default:
|
||||
writer = new CSharpSpecWriter();
|
||||
break;
|
||||
}
|
||||
var writer = new CSharpSpecWriter();
|
||||
writer.WriteBindings(generator);
|
||||
|
||||
ticks = DateTime.Now.Ticks - ticks;
|
||||
|
|
|
@ -205,8 +205,6 @@ namespace Bind
|
|||
|
||||
public string WindowsGDI = "OpenTK.Platform.Windows.API";
|
||||
|
||||
public GeneratorLanguage Language { get; set; }
|
||||
|
||||
public Settings Clone()
|
||||
{
|
||||
IFormatter formatter = new BinaryFormatter();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
// Copyright (c) 2006 - 2015 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
# Normal types.
|
||||
GLsizei, GLsizei
|
||||
GLsizeiptr, GLsizeiptr
|
||||
GLintptr, GLintptr
|
||||
# GLenum, GLenum
|
||||
GLboolean, bool # Boolean # Int32
|
||||
GLbitfield, GLbitfield
|
||||
# GLvoid*, IntPtr
|
||||
# GLvoid, Void #Object
|
||||
GLchar, GLchar
|
||||
GLbyte, GLbyte
|
||||
GLubyte, GLubyte
|
||||
GLshort, GLshort
|
||||
GLushort, GLushort
|
||||
GLint, GLint
|
||||
GLuint, GLuint
|
||||
GLfloat, GLfloat
|
||||
GLclampf, GLclampf
|
||||
GLdouble, GLdouble
|
||||
GLclampd, GLclampd
|
||||
GLstring, GLstring
|
||||
|
||||
PixelInternalFormat, PixelInternalFormat
|
||||
|
||||
# ARB and NV types.
|
||||
GLsizeiptrARB, GLsizeiptrARB
|
||||
GLintptrARB, GLintptrARB
|
||||
GLhandleARB, GLhandleARB
|
||||
GLhalfARB, GLhalfARB
|
||||
GLhalfNV, GLhalfNV
|
||||
GLcharARB, GLcharARB
|
||||
|
||||
# 64 bit types (introduced in 2.1)
|
||||
GLint64EXT, GLint64EXT
|
||||
GLuint64EXT, GLuint64EXT
|
||||
GLint64, GLint64
|
||||
GLuint64, GLuint64
|
||||
|
||||
# ARB_sync (introduced in 3.2)
|
||||
sync, GLsync
|
||||
GLsync, GLsync
|
||||
|
||||
# OpenGL|ES types.
|
||||
GLclampx, GLclampx
|
||||
GLfixed, GLfixed
|
||||
GLeglImageOES, GLeglImageOES
|
||||
|
||||
cl_addressing_mode, AddressingMode
|
||||
cl_command_queue_info, CommandQueueInfo
|
||||
cl_command_queue_properties, CommandQueueProperties
|
||||
cl_context_info, ContextInfo
|
||||
cl_context_properties, IntPtr # ContextProperties
|
||||
cl_device_info, DeviceInfo
|
||||
cl_device_type, DeviceType
|
||||
cl_event_info, EventInfo
|
||||
cl_filter_mode, FilterMode
|
||||
cl_image_format, ImageFormat
|
||||
cl_image_info, ImageInfo
|
||||
cl_kernel_group_info, KernelGroupInfo
|
||||
cl_kernel_info, KernelInfo
|
||||
cl_kernel_work_group_info, KernelWorkGroupInfo
|
||||
cl_map_flags, MapFlags
|
||||
cl_mem_info, MemInfo
|
||||
cl_mem_flags, MemFlags
|
||||
cl_mem_object_type, MemObjectType
|
||||
cl_platform_info, PlatformInfo
|
||||
cl_profiling_info, ProfilingInfo
|
||||
cl_program_build_info, ProgramBuildInfo
|
||||
cl_program_info, ProgramInfo
|
||||
cl_sampler_info, SamplerInfo
|
||||
cl_work_group_info, WorkGroupInfo
|
|
@ -1,149 +0,0 @@
|
|||
# Normal types.
|
||||
GLsizei, int
|
||||
GLsizeiptr, Integer
|
||||
GLintptr, Integer
|
||||
# GLenum, int
|
||||
GLboolean, boolean # bool # int
|
||||
GLbitfield, int
|
||||
# GLvoid*, Integer
|
||||
# GLvoid, Void #Object
|
||||
GLchar, char
|
||||
GLbyte, byte
|
||||
GLubyte, byte
|
||||
GLshort, short
|
||||
GLushort, short
|
||||
GLint, int
|
||||
GLuint, int
|
||||
GLfloat, float
|
||||
GLclampf, float
|
||||
GLdouble, double
|
||||
GLclampd, double
|
||||
GLstring, String
|
||||
|
||||
PixelInternalFormat, PixelInternalFormat
|
||||
|
||||
# ARB and NV types.
|
||||
GLsizeiptrARB, Integer
|
||||
GLintptrARB, Integer
|
||||
GLhandleARB, int
|
||||
GLhalfARB, Half
|
||||
GLhalfNV, Half
|
||||
GLcharARB, char
|
||||
|
||||
# 64 bit types (introduced in 2.1)
|
||||
GLint64EXT, long
|
||||
GLuint64EXT, long
|
||||
GLint64, long
|
||||
GLuint64, long
|
||||
|
||||
# ARB_sync (introduced in 3.2)
|
||||
sync, Integer
|
||||
GLsync, Integer
|
||||
|
||||
# Wgl types.
|
||||
PROC, Integer
|
||||
LPCSTR, String
|
||||
COLORREF, int
|
||||
BOOL, boolean
|
||||
DWORD, int
|
||||
FLOAT, float
|
||||
HANDLE, Integer
|
||||
HDC, Integer
|
||||
HGLRC, Integer
|
||||
HPBUFFERARB, Integer #HPBUFFERARB
|
||||
HPBUFFEREXT, Integer #HPBUFFEREXT
|
||||
INT32, int
|
||||
INT64, long
|
||||
LPVOID, void*
|
||||
#String, const char *
|
||||
UINT, int
|
||||
USHORT, short
|
||||
VOID, void
|
||||
VoidPointer, void*
|
||||
float, float
|
||||
int, int
|
||||
#void, *
|
||||
GLDEBUGPROCARB, DebugProcArb
|
||||
GLDEBUGPROCAMD , DebugProcAmd
|
||||
GLvdpauSurfaceNV, Integer
|
||||
|
||||
# Glu types.
|
||||
Float64 double
|
||||
Float64Pointer Double
|
||||
Float32 float
|
||||
Float32Pointer Float
|
||||
|
||||
# Glx types.
|
||||
Void void
|
||||
Bool boolean
|
||||
int64_t long
|
||||
int32_t int
|
||||
|
||||
Display Integer
|
||||
Window Integer
|
||||
Pixmap Integer
|
||||
Colormap Integer
|
||||
|
||||
GLXWindow Integer
|
||||
GLXContext Integer
|
||||
GLXDrawable Integer
|
||||
GLXPixmap Integer
|
||||
__GLXextFuncPtr Integer
|
||||
|
||||
VLServer Integer
|
||||
VLPath Integer
|
||||
VLNode Integer
|
||||
|
||||
|
||||
# OpenGL|ES types.
|
||||
GLclampx, int
|
||||
GLfixed, int
|
||||
GLeglImageOES, Integer
|
||||
|
||||
|
||||
# OpenCL types.
|
||||
_cl_context, Integer
|
||||
_cl_event, Integer
|
||||
cl_command_queue, Integer
|
||||
cl_context, Integer
|
||||
cl_device_id, Integer
|
||||
cl_event, Integer
|
||||
cl_kernel, Integer
|
||||
cl_mem, Integer
|
||||
cl_platform_id, Integer
|
||||
cl_program, Integer
|
||||
cl_sampler, Integer
|
||||
size_t, Integer # not exactly right, NativeLong is the correct one.
|
||||
|
||||
cl_bool, boolean
|
||||
cl_int, int
|
||||
cl_uint, uint
|
||||
uchar, byte
|
||||
|
||||
cl_addressing_mode, AddressingMode
|
||||
cl_command_queue_info, CommandQueueInfo
|
||||
cl_command_queue_properties, CommandQueueProperties
|
||||
cl_context_info, ContextInfo
|
||||
cl_context_properties, Integer # ContextProperties
|
||||
cl_device_info, DeviceInfo
|
||||
cl_device_type, DeviceType
|
||||
cl_event_info, EventInfo
|
||||
cl_filter_mode, FilterMode
|
||||
cl_image_format, ImageFormat
|
||||
cl_image_info, ImageInfo
|
||||
cl_kernel_group_info, KernelGroupInfo
|
||||
cl_kernel_info, KernelInfo
|
||||
cl_kernel_work_group_info, KernelWorkGroupInfo
|
||||
cl_map_flags, MapFlags
|
||||
cl_mem_info, MemInfo
|
||||
cl_mem_flags, MemFlags
|
||||
cl_mem_object_type, MemObjectType
|
||||
cl_platform_info, PlatformInfo
|
||||
cl_profiling_info, ProfilingInfo
|
||||
cl_program_build_info, ProgramBuildInfo
|
||||
cl_program_info, ProgramInfo
|
||||
cl_sampler_info, SamplerInfo
|
||||
cl_work_group_info, WorkGroupInfo
|
||||
|
||||
# OpenTK-specific
|
||||
IntPtr, Pointer # com.sun.jna
|
|
@ -167,18 +167,7 @@ namespace Bind
|
|||
|
||||
#region Keywords
|
||||
|
||||
public static List<string> Keywords(GeneratorLanguage language)
|
||||
{
|
||||
switch (language)
|
||||
{
|
||||
case GeneratorLanguage.CSharp: return CSharpKeywords;
|
||||
case GeneratorLanguage.Cpp: return CppKeywords;
|
||||
case GeneratorLanguage.Java: return JavaKeywords;
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
static readonly List<string> CSharpKeywords = new List<string>(
|
||||
public static readonly List<string> CSharpKeywords = new List<string>(
|
||||
new string[]
|
||||
{
|
||||
"abstract", "event", "new", "struct",
|
||||
|
@ -204,24 +193,6 @@ namespace Bind
|
|||
}
|
||||
);
|
||||
|
||||
static readonly List<string> JavaKeywords = new List<string>(
|
||||
new string[]
|
||||
{
|
||||
"abstract", "continue", "for", "new", "switch",
|
||||
"assert", "default", "goto", "package", "synchronized",
|
||||
"boolean", "do", "if", "private", "this",
|
||||
"break", "double", "implements", "protected", "throw",
|
||||
"byte", "else", "import", "public", "throws",
|
||||
"case", "enum", "instanceof", "return", "transient",
|
||||
"catch", "extends", "int", "short", "try",
|
||||
"char", "final", "interface", "static", "void",
|
||||
"class", "finally", "long", "strictfp", "volatile",
|
||||
"const", "float", "native", "super", "while",
|
||||
"callback"
|
||||
});
|
||||
|
||||
static readonly List<string> CppKeywords = new List<string>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Merge
|
||||
|
|
|
@ -1,213 +0,0 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2010 the Open Toolkit library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
// the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace CHeaderToXML
|
||||
{
|
||||
class GLParser : Parser
|
||||
{
|
||||
static readonly Regex extensions = new Regex(
|
||||
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
|
||||
RegexOptions.Compiled);
|
||||
static readonly char[] splitters = new char[] { ' ', '\t', ',', '(', ')', ';', '\n', '\r' };
|
||||
|
||||
enum ParserModes { None, Enum, Func };
|
||||
ParserModes CurrentMode;
|
||||
|
||||
enum EntryModes { Core, Compatibility };
|
||||
|
||||
public override IEnumerable<XElement> Parse(string[] lines)
|
||||
{
|
||||
XElement current = null;
|
||||
|
||||
foreach (string l in lines)
|
||||
{
|
||||
// Clean up line for further processing and skip invalid lines.
|
||||
string line = l.Replace('\t', ' ').Trim();
|
||||
if (!IsValid(line))
|
||||
continue;
|
||||
|
||||
string[] words = SplitWords(line);
|
||||
if (line.Contains("enum:"))
|
||||
{
|
||||
// This is a new enum definition
|
||||
if (current != null)
|
||||
yield return current;
|
||||
|
||||
current = new XElement("enum",
|
||||
new XAttribute("name", words[0]));
|
||||
|
||||
CurrentMode = ParserModes.Enum;
|
||||
}
|
||||
else if (line.StartsWith(words[0] + "("))
|
||||
{
|
||||
// This is a new function definition
|
||||
if (current != null)
|
||||
yield return current;
|
||||
|
||||
var match = extensions.Match(words[0]);
|
||||
string extension = match != null && String.IsNullOrEmpty(match.Value) ? "Core" : match.Value;
|
||||
current = new XElement("function",
|
||||
new XAttribute("name", words[0]),
|
||||
new XAttribute("extension", extension));
|
||||
|
||||
CurrentMode = ParserModes.Func;
|
||||
}
|
||||
else if (current != null)
|
||||
{
|
||||
// This is an addition to the current element (enum or function)
|
||||
switch (CurrentMode)
|
||||
{
|
||||
case ParserModes.Enum:
|
||||
if (words[0] == "use")
|
||||
{
|
||||
current.Add(new XElement("use",
|
||||
new XAttribute("enum", words[1]),
|
||||
new XAttribute("token", words[2])));
|
||||
}
|
||||
else if (words[1] == "=")
|
||||
{
|
||||
current.Add(new XElement("token",
|
||||
new XAttribute("name", words[0]),
|
||||
new XAttribute("value", words[2])));
|
||||
}
|
||||
else if (words[0] == "profile:")
|
||||
{
|
||||
}
|
||||
else if (words[0].Contains("future_use"))
|
||||
{
|
||||
// This is a bug in the 4.3 specs. Unfortunately,
|
||||
// Khronos is no longer accepting bug reports for
|
||||
// the .spec files.
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Typical cause is hand-editing the specs and forgetting to add an '=' sign.
|
||||
throw new InvalidOperationException(String.Format(
|
||||
"[Error] Invalid constant definition: \"{0}\"", line));
|
||||
}
|
||||
break;
|
||||
|
||||
case ParserModes.Func:
|
||||
switch (words[0])
|
||||
{
|
||||
case "return": // Line denotes return value
|
||||
current.Add(new XElement("returns",
|
||||
new XAttribute("type", words[1])));
|
||||
break;
|
||||
|
||||
case "param": // Line denotes parameter
|
||||
int pointer = words[4].Contains("array") ? 1 : 0;
|
||||
pointer += words[4].Contains("reference") ? 1 : 0;
|
||||
|
||||
var elem = new XElement("param",
|
||||
new XAttribute("name", words[1]),
|
||||
new XAttribute("type", words[2] + PointerLevel(pointer)),
|
||||
new XAttribute("flow", words[3] == "in" ? "in" : "out"));
|
||||
if (pointer > 0 && words.Length > 5 && words[5].Contains("[1]"))
|
||||
elem.Add(new XAttribute("count", 1));
|
||||
|
||||
current.Add(elem);
|
||||
break;
|
||||
|
||||
case "version": // Line denotes function version (i.e. 1.0, 1.2, 1.5)
|
||||
// GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
|
||||
var version = current.Attribute("version");
|
||||
if (version == null)
|
||||
current.Add(new XAttribute("version", words[1]));
|
||||
else
|
||||
version.Value = words[1];
|
||||
break;
|
||||
|
||||
case "category":
|
||||
current.Add(new XAttribute("category", words[1]));
|
||||
break;
|
||||
|
||||
case "deprecated":
|
||||
current.Add(new XAttribute("deprecated", words[1]));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current != null)
|
||||
{
|
||||
yield return current;
|
||||
}
|
||||
}
|
||||
|
||||
string[] SplitWords(string line)
|
||||
{
|
||||
return line.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
bool IsValid(string line)
|
||||
{
|
||||
return !(String.IsNullOrEmpty(line) ||
|
||||
line.StartsWith("#") || // Disregard comments.
|
||||
line.StartsWith("passthru") || // Disregard passthru statements.
|
||||
line.StartsWith("required-props:") ||
|
||||
line.StartsWith("param:") ||
|
||||
line.StartsWith("dlflags:") ||
|
||||
line.StartsWith("glxflags:") ||
|
||||
line.StartsWith("vectorequiv:") ||
|
||||
//line.StartsWith("category:") ||
|
||||
line.StartsWith("version:") ||
|
||||
line.StartsWith("glxsingle:") ||
|
||||
line.StartsWith("glxropcode:") ||
|
||||
line.StartsWith("glxvendorpriv:") ||
|
||||
line.StartsWith("glsflags:") ||
|
||||
line.StartsWith("glsopcode:") ||
|
||||
line.StartsWith("glsalias:") ||
|
||||
line.StartsWith("wglflags:") ||
|
||||
line.StartsWith("extension:") ||
|
||||
line.StartsWith("alias:") ||
|
||||
line.StartsWith("offset:"));
|
||||
}
|
||||
|
||||
string PointerLevel(int pointer)
|
||||
{
|
||||
switch (pointer)
|
||||
{
|
||||
case 0: return String.Empty;
|
||||
case 1: return "*";
|
||||
case 2: return "**";
|
||||
case 3: return "***";
|
||||
case 4: return "****";
|
||||
case 5: return "*****";
|
||||
default: throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -130,7 +130,6 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GLParser.cs" />
|
||||
<None Include="..\..\OpenTK.snk">
|
||||
<Link>OpenTK.snk</Link>
|
||||
</None>
|
||||
|
|
|
@ -63,7 +63,6 @@ namespace CHeaderToXML
|
|||
enum HeaderType
|
||||
{
|
||||
Header,
|
||||
Spec,
|
||||
Xml
|
||||
}
|
||||
|
||||
|
@ -112,7 +111,6 @@ namespace CHeaderToXML
|
|||
}
|
||||
Parser parser =
|
||||
type == HeaderType.Header ? new ESCLParser { Prefix = prefix, Version = version } :
|
||||
type == HeaderType.Spec ? new GLParser { Prefix = prefix, Version = version } :
|
||||
type == HeaderType.Xml ? new GLXmlParser { Prefix = prefix, Version = version } :
|
||||
(Parser)null;
|
||||
|
||||
|
|
|
@ -49,7 +49,27 @@ namespace CHeaderToXML
|
|||
using (var wb = new WebClient())
|
||||
{
|
||||
string filename = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
|
||||
wb.DownloadFile(path, filename);
|
||||
|
||||
try
|
||||
{
|
||||
wb.DownloadFile(path, filename);
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Message == "The remote server returned an error: (401) Unauthorized.")
|
||||
{
|
||||
System.Console.WriteLine(e.Message);
|
||||
System.Console.Write("Username: ");
|
||||
string username = System.Console.ReadLine();
|
||||
System.Console.Write("Password: ");
|
||||
string password = System.Console.ReadLine();
|
||||
|
||||
wb.UseDefaultCredentials = true;
|
||||
wb.Credentials = new NetworkCredential(username, password);
|
||||
wb.DownloadFile(path, filename);
|
||||
}
|
||||
}
|
||||
|
||||
contents = File.ReadAllLines(filename);
|
||||
File.Delete(filename);
|
||||
}
|
||||
|
|
|
@ -5,25 +5,21 @@ This is a simple tool to convert C headers to XML files. It works using simple p
|
|||
|
||||
[Examples]
|
||||
|
||||
To download and convert the new XML API registry from Khronos:
|
||||
To download and convert the XML API registry from Khronos:
|
||||
Convert.exe -p:gl -t:xml -o:../../../Source/Bind/Specifications/GL2/signatures.xml https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml
|
||||
|
||||
To download and convert the old .spec files from Khronos:
|
||||
Convert.exe -p:gl -t:spec -o:../../../Source/Bind/Specifications/GL2/signatures.xml https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/oldspecs/gl.spec https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/oldspecs/enum.spec https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/oldspecs/enumext.spec
|
||||
|
||||
The line above will download the latest .spec files from the public Khronos repository and update signatures.xml for the binding generator.
|
||||
The line above will download the latest .xml files from the public Khronos repository and update signatures.xml for the binding generator.
|
||||
|
||||
[Usage]
|
||||
|
||||
Convert.exe -p:{PREFIX} -v:{VERSION} -t:{TYPE} -o:{OUT} {INPUT1} ... {INPUTn}
|
||||
{PREFIX} is a simple string that defines the a common prefix for functions and constants in this header. This prefix will be removed from the generated XML file.
|
||||
{VERSION} is a string that defines that version that will be used for functions in the generated XML file. Specific input files may override this setting.
|
||||
{TYPE} can be either 'spec' or 'header' to indicate whether the input files are OpenGL .spec files or C headers.
|
||||
{TYPE} can be either 'xml' or 'header' to indicate whether the input files are OpenGL .xml files or C headers.
|
||||
{OUT} is the output filename (optional). If no output file is specified, output will be directed to the console.
|
||||
{INPUT1..n} is a space-separated list of input files (headers).
|
||||
|
||||
Despite what the help says, all three parameters are necessary at the moment.
|
||||
|
||||
Despite what the help says, prefix, version and type parameters are necessary at the moment.
|
||||
|
||||
[Support]
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
// Copyright (c) 2006 - 2015 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -12293,6 +12293,13 @@ namespace OpenTK.Graphics.ES11
|
|||
Byte = ((int)0x1400) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum OesCompressedEtc1Rgb8SubTexture : int
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
// Copyright (c) 2006 - 2015 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -165,7 +165,7 @@ namespace OpenTK.Graphics.ES20
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.Amd.GetPerfMonitorCounterData, GL.Amd.GetPerfMonitorCounterInfo and 163 other functions
|
||||
/// Used in GL.Amd.GetPerfMonitorCounterData, GL.Amd.GetPerfMonitorCounterInfo and 165 other functions
|
||||
/// </summary>
|
||||
public enum All : int
|
||||
{
|
||||
|
@ -950,6 +950,14 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
InvalidFramebufferOperationOes = ((int)0x0506) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST_KHR = 0x0507
|
||||
/// </summary>
|
||||
ContextLostKhr = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_2D = 0x0600
|
||||
/// </summary>
|
||||
Gl2D = ((int)0x0600) ,
|
||||
|
@ -4782,26 +4790,66 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
DebugTypeOtherKhr = ((int)0x8251) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnReset = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_EXT = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetExt = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_KHR = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetKhr = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_EXT = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetExt = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_KHR = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetKhr = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_EXT = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetExt = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_KHR = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetKhr = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_EXT = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetExt = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_KHR = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetKhr = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_EXT = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyExt = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_KHR = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyKhr = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257
|
||||
/// </summary>
|
||||
ProgramBinaryRetrievableHint = ((int)0x8257) ,
|
||||
|
@ -4826,10 +4874,18 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
UndefinedVertexExt = ((int)0x8260) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotification = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_EXT = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationExt = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_KHR = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationKhr = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_DEBUG_TYPE_MARKER = 0x8268
|
||||
/// </summary>
|
||||
DebugTypeMarker = ((int)0x8268) ,
|
||||
|
@ -4954,6 +5010,22 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
MaxLabelLengthKhr = ((int)0x82E8) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehavior = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlush = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlushKhr = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONVOLUTION_HINT_SGIX = 0x8316
|
||||
/// </summary>
|
||||
ConvolutionHintSgix = ((int)0x8316) ,
|
||||
|
@ -7202,10 +7274,18 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
MaxMultiviewBuffersExt = ((int)0x90F2) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_EXT = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessExt = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_KHR = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessKhr = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES = 0x9102
|
||||
/// </summary>
|
||||
Texture2DMultisampleArrayOes = ((int)0x9102) ,
|
||||
|
@ -10297,6 +10377,10 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
InvalidFramebufferOperationOes = ((int)0x0506) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_TABLE_TOO_LARGE = 0x8031
|
||||
/// </summary>
|
||||
TableTooLarge = ((int)0x8031) ,
|
||||
|
@ -15101,6 +15185,14 @@ namespace OpenTK.Graphics.ES20
|
|||
/// </summary>
|
||||
SharedTexturePaletteExt = ((int)0x81FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONVOLUTION_HINT_SGIX = 0x8316
|
||||
/// </summary>
|
||||
ConvolutionHintSgix = ((int)0x8316) ,
|
||||
|
@ -15364,6 +15456,10 @@ namespace OpenTK.Graphics.ES20
|
|||
/// Original was GL_MAX_MULTIVIEW_BUFFERS_EXT = 0x90F2
|
||||
/// </summary>
|
||||
MaxMultiviewBuffersExt = ((int)0x90F2) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -16594,6 +16690,44 @@ namespace OpenTK.Graphics.ES20
|
|||
HslLuminosityKhr = ((int)0x92B0) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrBlendEquationAdvancedCoherent : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_BLEND_ADVANCED_COHERENT_KHR = 0x9285
|
||||
/// </summary>
|
||||
BlendAdvancedCoherentKhr = ((int)0x9285) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrContextFlushControl : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NONE = 0
|
||||
/// </summary>
|
||||
None = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehavior = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlush = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlushKhr = ((int)0x82FC) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -16921,6 +17055,88 @@ namespace OpenTK.Graphics.ES20
|
|||
DebugOutputKhr = ((int)0x92E0) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrRobustBufferAccessBehavior : int
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrRobustness : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NO_ERROR = 0
|
||||
/// </summary>
|
||||
NoError = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST_KHR = 0x0507
|
||||
/// </summary>
|
||||
ContextLostKhr = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnReset = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_KHR = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetKhr = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_KHR = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetKhr = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_KHR = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetKhr = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_KHR = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetKhr = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_KHR = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyKhr = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotification = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_KHR = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationKhr = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_KHR = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessKhr = ((int)0x90F3) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -18801,6 +19017,13 @@ namespace OpenTK.Graphics.ES20
|
|||
QueryAllEventBitsAmd = unchecked((int)0xFFFFFFFF) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum OesCompressedEtc1Rgb8SubTexture : int
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -19574,7 +19797,7 @@ namespace OpenTK.Graphics.ES20
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.CompressedTexSubImage2D, GL.ReadPixels and 3 other functions
|
||||
/// Used in GL.CompressedTexSubImage2D, GL.ReadnPixels and 6 other functions
|
||||
/// </summary>
|
||||
public enum PixelFormat : int
|
||||
{
|
||||
|
@ -20181,7 +20404,7 @@ namespace OpenTK.Graphics.ES20
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.ReadPixels, GL.TexImage2D and 2 other functions
|
||||
/// Used in GL.ReadnPixels, GL.ReadPixels and 5 other functions
|
||||
/// </summary>
|
||||
public enum PixelType : int
|
||||
{
|
||||
|
@ -20967,6 +21190,29 @@ namespace OpenTK.Graphics.ES20
|
|||
Select = ((int)0x1C02) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum ResetStatus : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NO_ERROR = 0
|
||||
/// </summary>
|
||||
NoError = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
// Copyright (c) 2006 - 2015 Stefanos Apostolopoulos for the Open Toolkit Library
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -383,7 +383,7 @@ namespace OpenTK.Graphics.ES30
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.Amd.GetPerfMonitorCounterData, GL.Amd.GetPerfMonitorCounterInfo and 211 other functions
|
||||
/// Used in GL.Amd.GetPerfMonitorCounterData, GL.Amd.GetPerfMonitorCounterInfo and 213 other functions
|
||||
/// </summary>
|
||||
public enum All : int
|
||||
{
|
||||
|
@ -1172,6 +1172,14 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
InvalidFramebufferOperationOes = ((int)0x0506) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST_KHR = 0x0507
|
||||
/// </summary>
|
||||
ContextLostKhr = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_2D = 0x0600
|
||||
/// </summary>
|
||||
Gl2D = ((int)0x0600) ,
|
||||
|
@ -5160,26 +5168,66 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
DebugTypeOtherKhr = ((int)0x8251) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnReset = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_EXT = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetExt = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_KHR = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetKhr = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_EXT = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetExt = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_KHR = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetKhr = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_EXT = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetExt = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_KHR = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetKhr = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_EXT = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetExt = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_KHR = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetKhr = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_EXT = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyExt = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_KHR = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyKhr = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257
|
||||
/// </summary>
|
||||
ProgramBinaryRetrievableHint = ((int)0x8257) ,
|
||||
|
@ -5204,10 +5252,18 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
UndefinedVertexExt = ((int)0x8260) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotification = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_EXT = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationExt = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_KHR = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationKhr = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_DEBUG_TYPE_MARKER = 0x8268
|
||||
/// </summary>
|
||||
DebugTypeMarker = ((int)0x8268) ,
|
||||
|
@ -5332,6 +5388,22 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
MaxLabelLengthKhr = ((int)0x82E8) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehavior = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlush = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlushKhr = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONVOLUTION_HINT_SGIX = 0x8316
|
||||
/// </summary>
|
||||
ConvolutionHintSgix = ((int)0x8316) ,
|
||||
|
@ -8364,10 +8436,18 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
MaxMultiviewBuffersExt = ((int)0x90F2) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_EXT = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessExt = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_KHR = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessKhr = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES = 0x9102
|
||||
/// </summary>
|
||||
Texture2DMultisampleArrayOes = ((int)0x9102) ,
|
||||
|
@ -11864,6 +11944,10 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
InvalidFramebufferOperationOes = ((int)0x0506) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_TABLE_TOO_LARGE = 0x8031
|
||||
/// </summary>
|
||||
TableTooLarge = ((int)0x8031) ,
|
||||
|
@ -18154,6 +18238,14 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
NumExtensions = ((int)0x821D) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONVOLUTION_HINT_SGIX = 0x8316
|
||||
/// </summary>
|
||||
ConvolutionHintSgix = ((int)0x8316) ,
|
||||
|
@ -18642,6 +18734,10 @@ namespace OpenTK.Graphics.ES30
|
|||
/// </summary>
|
||||
MaxMultiviewBuffersExt = ((int)0x90F2) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111
|
||||
/// </summary>
|
||||
MaxServerWaitTimeout = ((int)0x9111) ,
|
||||
|
@ -19973,6 +20069,44 @@ namespace OpenTK.Graphics.ES30
|
|||
HslLuminosityKhr = ((int)0x92B0) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrBlendEquationAdvancedCoherent : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_BLEND_ADVANCED_COHERENT_KHR = 0x9285
|
||||
/// </summary>
|
||||
BlendAdvancedCoherentKhr = ((int)0x9285) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrContextFlushControl : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NONE = 0
|
||||
/// </summary>
|
||||
None = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehavior = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_KHR = 0x82FB
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorKhr = ((int)0x82FB) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlush = ((int)0x82FC) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR = 0x82FC
|
||||
/// </summary>
|
||||
ContextReleaseBehaviorFlushKhr = ((int)0x82FC) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -20300,6 +20434,88 @@ namespace OpenTK.Graphics.ES30
|
|||
DebugOutputKhr = ((int)0x92E0) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrRobustBufferAccessBehavior : int
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum KhrRobustness : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NO_ERROR = 0
|
||||
/// </summary>
|
||||
NoError = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST = 0x0507
|
||||
/// </summary>
|
||||
ContextLost = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_LOST_KHR = 0x0507
|
||||
/// </summary>
|
||||
ContextLostKhr = ((int)0x0507) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnReset = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_LOSE_CONTEXT_ON_RESET_KHR = 0x8252
|
||||
/// </summary>
|
||||
LoseContextOnResetKhr = ((int)0x8252) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET_KHR = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextResetKhr = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET_KHR = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextResetKhr = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET_KHR = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextResetKhr = ((int)0x8255) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategy = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_RESET_NOTIFICATION_STRATEGY_KHR = 0x8256
|
||||
/// </summary>
|
||||
ResetNotificationStrategyKhr = ((int)0x8256) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotification = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_NO_RESET_NOTIFICATION_KHR = 0x8261
|
||||
/// </summary>
|
||||
NoResetNotificationKhr = ((int)0x8261) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccess = ((int)0x90F3) ,
|
||||
/// <summary>
|
||||
/// Original was GL_CONTEXT_ROBUST_ACCESS_KHR = 0x90F3
|
||||
/// </summary>
|
||||
ContextRobustAccessKhr = ((int)0x90F3) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -22184,6 +22400,13 @@ namespace OpenTK.Graphics.ES30
|
|||
QueryAllEventBitsAmd = unchecked((int)0xFFFFFFFF) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum OesCompressedEtc1Rgb8SubTexture : int
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
@ -22957,7 +23180,7 @@ namespace OpenTK.Graphics.ES30
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.CompressedTexSubImage2D, GL.CompressedTexSubImage3D and 6 other functions
|
||||
/// Used in GL.CompressedTexSubImage2D, GL.CompressedTexSubImage3D and 9 other functions
|
||||
/// </summary>
|
||||
public enum PixelFormat : int
|
||||
{
|
||||
|
@ -23592,7 +23815,7 @@ namespace OpenTK.Graphics.ES30
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in GL.ReadPixels, GL.TexImage2D and 4 other functions
|
||||
/// Used in GL.ReadnPixels, GL.ReadPixels and 7 other functions
|
||||
/// </summary>
|
||||
public enum PixelType : int
|
||||
{
|
||||
|
@ -24742,6 +24965,29 @@ namespace OpenTK.Graphics.ES30
|
|||
Select = ((int)0x1C02) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
public enum ResetStatus : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Original was GL_NO_ERROR = 0
|
||||
/// </summary>
|
||||
NoError = ((int)0) ,
|
||||
/// <summary>
|
||||
/// Original was GL_GUILTY_CONTEXT_RESET = 0x8253
|
||||
/// </summary>
|
||||
GuiltyContextReset = ((int)0x8253) ,
|
||||
/// <summary>
|
||||
/// Original was GL_INNOCENT_CONTEXT_RESET = 0x8254
|
||||
/// </summary>
|
||||
InnocentContextReset = ((int)0x8254) ,
|
||||
/// <summary>
|
||||
/// Original was GL_UNKNOWN_CONTEXT_RESET = 0x8255
|
||||
/// </summary>
|
||||
UnknownContextReset = ((int)0x8255) ,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used directly.
|
||||
/// </summary>
|
||||
|
|
30334
Source/OpenTK/Graphics/ES31/ES31.Enums.cs
Normal file
30334
Source/OpenTK/Graphics/ES31/ES31.Enums.cs
Normal file
File diff suppressed because it is too large
Load diff
38422
Source/OpenTK/Graphics/ES31/ES31.cs
Normal file
38422
Source/OpenTK/Graphics/ES31/ES31.cs
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue