mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-22 20:45:38 +00:00
Merge branch 'no-reflect'
Conflicts: OpenTK.sln Source/Bind/FuncProcessor.cs Source/OpenTK/Graphics/ES11/ES11.cs Source/OpenTK/Graphics/ES11/ES11Core.cs Source/OpenTK/Graphics/ES11/ES11Delegates.cs Source/OpenTK/Graphics/ES20/ES20.cs Source/OpenTK/Graphics/OpenGL/GL.cs Source/OpenTK/Graphics/OpenGL/GLCore.cs Source/OpenTK/Graphics/OpenGL/GLDelegates.cs Source/OpenTK/Graphics/OpenGL/GLObsolete.cs
This commit is contained in:
commit
87030c0e68
36
Dependencies/Readme.txt
vendored
36
Dependencies/Readme.txt
vendored
|
@ -3,18 +3,20 @@ dependencies for OpenTK. These are meant for your convenience
|
|||
and are completely optional to use.
|
||||
|
||||
The folder structure is split by CPU architecture:
|
||||
Dependencies/license - license files
|
||||
Dependencies/managed - .Net assemblies compiled for AnyCPU
|
||||
Dependencies/x86/ - compiled for 32bit Intel and AMD processors
|
||||
Dependencies/x64/ - compiled for 64bit Intel and AMD processors
|
||||
Dependencies/ - contains readme and license files
|
||||
|
||||
The dependencies are as follows:
|
||||
To deploy a dependency, simply copy it to your application directory, along with the relevant license file.
|
||||
|
||||
Detailed instructions follow.
|
||||
|
||||
|
||||
[SDL2.dll]
|
||||
[libSDL2.dylib]
|
||||
|
||||
The Simple DirectMedia Library compiled for Windows and Mac OS X.
|
||||
Copy these to your application directory in order to use the SDL2
|
||||
The Simple DirectMedia Library compiled for Windows and Mac OS X. Copy to your application directory in order to enable the SDL2
|
||||
platform backend for OpenTK.
|
||||
|
||||
http://libsdl.org
|
||||
|
@ -55,15 +57,25 @@ Linux and Mac OS X support OpenAL out of the box.
|
|||
[libGLESv2.dll]
|
||||
[d3dcompiler_46.dll]
|
||||
|
||||
ANGLE Project compiled for Windows. Copy these to your application
|
||||
directory in order to use OpenGL ES 2.0 on Windows.
|
||||
ANGLE Project compiled for Windows. Copy these to your application directory in order to use OpenGL ES 2.0 on Windows.
|
||||
|
||||
https://code.google.com/p/angleproject/
|
||||
|
||||
"The goal of ANGLE is to allow Windows users to seamlessly run WebGL
|
||||
and other OpenGL ES 2.0 content by translating OpenGL ES 2.0 API
|
||||
calls to DirectX 9 or DirectX 11 API calls."
|
||||
"The goal of ANGLE is to allow Windows users to seamlessly run WebGL and other OpenGL ES 2.0 content by translating OpenGL ES 2.0 API calls to DirectX 9 or DirectX 11 API calls."
|
||||
|
||||
These are required if you wish to publish an OpenGL ES application
|
||||
to the Windows Store. You can also use these in order to port or test
|
||||
OpenGL ES code from and to mobile devices (Android, iPhone).
|
||||
These are required if you wish to publish an OpenGL ES application to the Windows Store. You can also use these in order to port or test OpenGL ES code from and to mobile devices (Android, iPhone).
|
||||
|
||||
|
||||
[monolinker]
|
||||
|
||||
Mono Linker project. Use this to reduce the size of OpenTK.dll.
|
||||
|
||||
http://www.mono-project.com/Linker
|
||||
|
||||
"The linker is a tool one can use to only ship the minimal possible set of functions that a set of programs might require to run as opposed to the full libraries."
|
||||
|
||||
Execute as follows:
|
||||
|
||||
monolinker.exe -a YourApplication.exe
|
||||
|
||||
where "YourApplication.exe" is the name of your application binary. This command will create a new folder "output/" with a copy of your application and optimized version of OpenTK.dll and any other dll your application is using.
|
19
Dependencies/license/cecil.COPYING.txt
vendored
Normal file
19
Dependencies/license/cecil.COPYING.txt
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2008 - 2011, Jb Evain
|
||||
|
||||
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.
|
20
Dependencies/license/ikvm.COPYING.txt
vendored
Normal file
20
Dependencies/license/ikvm.COPYING.txt
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright (C) 2002-2012 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jeroen Frijters
|
||||
jeroen@frijters.net
|
21
Dependencies/license/monolinker.COPYING.txt
vendored
Normal file
21
Dependencies/license/monolinker.COPYING.txt
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
Copyright (c) 2007 Novell, Inc and the individuals listed on the
|
||||
ChangeLog entries.
|
||||
|
||||
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.
|
BIN
Dependencies/managed/IKVM.Reflection.dll
vendored
Normal file
BIN
Dependencies/managed/IKVM.Reflection.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/managed/Mono.Cecil.Mdb.dll
vendored
Normal file
BIN
Dependencies/managed/Mono.Cecil.Mdb.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/managed/Mono.Cecil.Pdb.dll
vendored
Normal file
BIN
Dependencies/managed/Mono.Cecil.Pdb.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/managed/Mono.Cecil.Rocks.dll
vendored
Normal file
BIN
Dependencies/managed/Mono.Cecil.Rocks.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/managed/Mono.Cecil.dll
vendored
Normal file
BIN
Dependencies/managed/Mono.Cecil.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/managed/monolinker.exe
vendored
Normal file
BIN
Dependencies/managed/monolinker.exe
vendored
Normal file
Binary file not shown.
18
OpenTK.sln
18
OpenTK.sln
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
|
@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
|
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "Source\OpenTK\OpenTK.csproj", "{A37A7E14-0000-0000-0000-000000000000}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB} = {C426C9D1-8857-4E52-BAC7-4C05EE6070AB}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Compatibility", "Source\Compatibility\OpenTK.Compatibility.csproj", "{62C0DB35-0000-0000-0000-000000000000}"
|
||||
|
@ -33,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nuget", "In
|
|||
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Rewrite", "Source\Generator.Rewrite\Generator.Rewrite.csproj", "{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -111,11 +114,14 @@ Global
|
|||
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F12FE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F12FE7B}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F12FE7B}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F12FE7B}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
|
||||
{ADC34399-7613-44D2-90B2-19250F12FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Documentation|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Nsis|Any CPU.Build.0 = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -77,8 +77,6 @@ namespace Bind
|
|||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
string temp_enums_file = Path.GetTempFileName();
|
||||
string temp_delegates_file = Path.GetTempFileName();
|
||||
string temp_core_file = Path.GetTempFileName();
|
||||
string temp_wrappers_file = Path.GetTempFileName();
|
||||
|
||||
// Enums
|
||||
|
@ -114,43 +112,6 @@ namespace Bind
|
|||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
// Delegates
|
||||
using (BindStreamWriter sw = new BindStreamWriter(temp_delegates_file))
|
||||
{
|
||||
WriteLicense(sw);
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Text;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
sw.WriteLine("#pragma warning disable 0649");
|
||||
WriteDelegates(sw, delegates);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
// Core
|
||||
using (BindStreamWriter sw = new BindStreamWriter(temp_core_file))
|
||||
{
|
||||
WriteLicense(sw);
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
//specWriter.WriteTypes(sw, Bind.Structures.Type.CSTypes);
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Text;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
WriteImports(sw, delegates);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
// Wrappers
|
||||
using (BindStreamWriter sw = new BindStreamWriter(temp_wrappers_file))
|
||||
{
|
||||
|
@ -163,7 +124,7 @@ namespace Bind
|
|||
sw.WriteLine("using System.Text;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
WriteWrappers(sw, wrappers, enums, Generator.CSTypes);
|
||||
WriteWrappers(sw, wrappers, delegates, enums, Generator.CSTypes);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
@ -180,115 +141,47 @@ namespace Bind
|
|||
if (File.Exists(output_wrappers)) File.Delete(output_wrappers);
|
||||
|
||||
File.Move(temp_enums_file, output_enums);
|
||||
File.Move(temp_delegates_file, output_delegates);
|
||||
File.Move(temp_core_file, output_core);
|
||||
File.Move(temp_wrappers_file, output_wrappers);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteDelegates
|
||||
|
||||
void WriteDelegates(BindStreamWriter sw, DelegateCollection delegates)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Writing delegates to:\t{0}.{1}.{2}", Settings.OutputNamespace, Settings.OutputClass, Settings.DelegatesClass));
|
||||
|
||||
sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
|
||||
sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
sw.WriteLine("internal static partial class {0}", Settings.DelegatesClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
foreach (var overloads in delegates.Values)
|
||||
{
|
||||
// Generate only one delegate per entry point..
|
||||
// Overloads are only used for wrapper generation,
|
||||
// so ignore them.
|
||||
var d = overloads.First();
|
||||
|
||||
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
|
||||
sw.WriteLine("internal {0};", GetDeclarationString(d, true));
|
||||
sw.WriteLine("internal {0}static {2} {1}{2};", // = null
|
||||
d.Unsafe ? "unsafe " : "",
|
||||
Settings.FunctionPrefix,
|
||||
d.Name);
|
||||
}
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteImports
|
||||
|
||||
public void WriteImports(BindStreamWriter sw, DelegateCollection delegates)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Writing imports to:\t{0}.{1}.{2}", Settings.OutputNamespace, Settings.OutputClass, Settings.ImportsClass));
|
||||
|
||||
sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
|
||||
sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("internal static partial class {0}", Settings.ImportsClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
//sw.WriteLine("static {0}() {1} {2}", Settings.ImportsClass, "{", "}"); // Disable BeforeFieldInit
|
||||
sw.WriteLine();
|
||||
foreach (var overloads in delegates.Values)
|
||||
{
|
||||
var d = overloads.First(); // generate only 1 DllImport per entry point
|
||||
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
|
||||
sw.WriteLine(
|
||||
"[System.Runtime.InteropServices.DllImport({0}.Library, EntryPoint = \"{1}{2}\"{3})]",
|
||||
Settings.OutputClass,
|
||||
Settings.FunctionPrefix,
|
||||
d.EntryPoint,
|
||||
d.EntryPoint.EndsWith("W") || d.EntryPoint.EndsWith("A") ? ", CharSet = CharSet.Auto" : ", ExactSpelling = true"
|
||||
);
|
||||
sw.WriteLine("internal extern static {0};", GetDeclarationString(d, false));
|
||||
}
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WriteWrappers
|
||||
|
||||
void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers, EnumCollection enums, IDictionary<string, string> CSTypes)
|
||||
void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
|
||||
DelegateCollection delegates, EnumCollection enums,
|
||||
IDictionary<string, string> CSTypes)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Writing wrappers to:\t{0}.{1}", Settings.OutputNamespace, Settings.OutputClass));
|
||||
|
||||
sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
|
||||
sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
|
||||
sw.WriteLine("#pragma warning disable 1572"); // Wrong param comments
|
||||
sw.WriteLine("#pragma warning disable 1573"); // Missing param comments
|
||||
sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
|
||||
sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
|
||||
sw.WriteLine("#pragma warning disable 1572"); // Wrong param comments
|
||||
sw.WriteLine("#pragma warning disable 1573"); // Missing param comments
|
||||
sw.WriteLine("#pragma warning disable 626"); // extern method without DllImport
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
|
||||
sw.Indent();
|
||||
//sw.WriteLine("static {0}() {1} {2}", className, "{", "}"); // Static init in GLHelper.cs
|
||||
|
||||
// Write constructor
|
||||
sw.WriteLine("static {0}()", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine("EntryPointNames = new string[]", delegates.Count);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
foreach (var d in delegates.Values.Select(d => d.First()))
|
||||
sw.WriteLine("\"{0}{1}\",", Settings.FunctionPrefix, d.Name);
|
||||
sw.Unindent();
|
||||
sw.WriteLine("};");
|
||||
sw.WriteLine("EntryPoints = new IntPtr[EntryPointNames.Length];");
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
|
||||
int current = 0;
|
||||
int current_wrapper = 0;
|
||||
foreach (string key in wrappers.Keys)
|
||||
{
|
||||
if (((Settings.Compatibility & Settings.Legacy.NoSeparateFunctionNamespaces) == Settings.Legacy.None) && key != "Core")
|
||||
|
@ -309,7 +202,8 @@ namespace Bind
|
|||
wrappers[key].Sort();
|
||||
foreach (Function f in wrappers[key])
|
||||
{
|
||||
current = WriteWrapper(sw, current, f, enums);
|
||||
WriteWrapper(sw, f, enums);
|
||||
current_wrapper++;
|
||||
}
|
||||
|
||||
if (((Settings.Compatibility & Settings.Legacy.NoSeparateFunctionNamespaces) == Settings.Legacy.None) && key != "Core")
|
||||
|
@ -319,28 +213,36 @@ namespace Bind
|
|||
sw.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
// Emit native signatures.
|
||||
// These are required by the patcher.
|
||||
int current_signature = 0;
|
||||
foreach (var d in wrappers.Values.SelectMany(e => e).Select(w => w.WrappedDelegate).Distinct())
|
||||
{
|
||||
sw.WriteLine("[Slot({0})]", d.Slot);
|
||||
sw.WriteLine("[DllImport(Library, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]");
|
||||
sw.WriteLine("static extern {0};", GetDeclarationString(d, false));
|
||||
current_signature++;
|
||||
}
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
||||
Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature);
|
||||
}
|
||||
|
||||
int WriteWrapper(BindStreamWriter sw, int current, Function f, EnumCollection enums)
|
||||
void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
|
||||
{
|
||||
if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
|
||||
{
|
||||
string text = String.Format("Writing function #{0}: {1}", current++, f.ToString());
|
||||
ConsoleRewrite(text);
|
||||
|
||||
WriteDocumentation(sw, f);
|
||||
}
|
||||
WriteMethod(sw, f, enums);
|
||||
sw.WriteLine();
|
||||
return current;
|
||||
}
|
||||
|
||||
private void WriteMethod(BindStreamWriter sw, Function f, EnumCollection enums)
|
||||
{
|
||||
CreateBody(f, enums);
|
||||
|
||||
if (!String.IsNullOrEmpty(f.Obsolete))
|
||||
{
|
||||
sw.WriteLine("[Obsolete(\"{0}\")]", f.Obsolete);
|
||||
|
@ -357,9 +259,7 @@ namespace Bind
|
|||
|
||||
sw.WriteLine("[AutoGenerated(Category = \"{0}\", Version = \"{1}\", EntryPoint = \"{2}\")]",
|
||||
f.Category, f.Version, Settings.FunctionPrefix + f.WrappedDelegate.EntryPoint);
|
||||
sw.WriteLine("public static ");
|
||||
sw.Write(GetDeclarationString(f));
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("public static extern {0};", GetDeclarationString(f, Settings.Compatibility));
|
||||
}
|
||||
|
||||
DocProcessor processor_;
|
||||
|
@ -524,9 +424,6 @@ namespace Bind
|
|||
int current = 0;
|
||||
foreach (Enum @enum in enums.Values)
|
||||
{
|
||||
string text = String.Format("Writing enum #{0}: {1}", current++, @enum.Name);
|
||||
ConsoleRewrite(text);
|
||||
|
||||
if (!Settings.IsEnabled(Settings.Legacy.NoDocumentation))
|
||||
{
|
||||
// Document which functions use this enum.
|
||||
|
@ -609,302 +506,6 @@ namespace Bind
|
|||
return enums.ContainsKey(s);
|
||||
}
|
||||
|
||||
void CreateBody(Function func, EnumCollection enums)
|
||||
{
|
||||
Function f = new Function(func);
|
||||
f.Body.Clear();
|
||||
|
||||
var handle_statements = new List<string>();
|
||||
var handle_release_statements = new List<string>();
|
||||
var fixed_statements = new List<string>();
|
||||
var assign_statements = new List<string>();
|
||||
var declaration_statements = new List<string>();
|
||||
|
||||
// Obtain pointers by pinning the parameters
|
||||
int index = -1;
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
index++;
|
||||
if (p.NeedsPin)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
// Use GCHandle to obtain pointer to generic parameters and 'fixed' for arrays.
|
||||
// This is because fixed can only take the address of fields, not managed objects.
|
||||
handle_statements.Add(String.Format(
|
||||
"{0} {1}_ptr = {0}.Alloc({1}, GCHandleType.Pinned);",
|
||||
"GCHandle", p.Name));
|
||||
|
||||
handle_release_statements.Add(String.Format("{0}_ptr.Free();", p.Name));
|
||||
|
||||
// Due to the GCHandle-style pinning (which boxes value types), we need to assign the modified
|
||||
// value back to the reference parameter (but only if it has an out or in/out flow direction).
|
||||
if ((p.Flow == FlowDirection.Out || p.Flow == FlowDirection.Undefined) && p.Reference)
|
||||
{
|
||||
assign_statements.Add(String.Format(
|
||||
"{0} = ({1}){0}_ptr.Target;",
|
||||
p.Name, p.QualifiedType));
|
||||
}
|
||||
}
|
||||
else if (p.WrapperType == WrapperTypes.PointerParameter ||
|
||||
p.WrapperType == WrapperTypes.ArrayParameter ||
|
||||
p.WrapperType == WrapperTypes.ReferenceParameter)
|
||||
{
|
||||
// A fixed statement is issued for all non-generic pointers, arrays and references.
|
||||
fixed_statements.Add(String.Format(
|
||||
"fixed ({0}{3} {1} = {2})",
|
||||
p.QualifiedType,
|
||||
p.Name + "_ptr",
|
||||
p.Array > 0 ? p.Name : "&" + p.Name,
|
||||
pointer_levels[p.IndirectionLevel]));
|
||||
|
||||
// Arrays are not value types, so we don't need to do anything for them.
|
||||
// Pointers are passed directly by value, so we don't need to assign them back either (they don't change).
|
||||
if ((p.Flow == FlowDirection.Out || p.Flow == FlowDirection.Undefined) && p.Reference)
|
||||
{
|
||||
assign_statements.Add(String.Format("{0} = *{0}_ptr;", p.Name));
|
||||
}
|
||||
}
|
||||
else if (p.WrapperType == WrapperTypes.None)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException(String.Format(
|
||||
"Unknown wrapper type '{0}', code generation failed",
|
||||
p.WrapperType));
|
||||
}
|
||||
}
|
||||
else if (p.WrapperType == WrapperTypes.ConvenienceArrayType)
|
||||
{
|
||||
var p_array = f.WrappedDelegate.Parameters[f.WrappedDelegate.Parameters.Count - 1];
|
||||
var p_size = f.WrappedDelegate.Parameters[f.WrappedDelegate.Parameters.Count - 2];
|
||||
declaration_statements.Add(String.Format(
|
||||
"const {0} = 1;",
|
||||
GetDeclarationString(p_size, false)));
|
||||
declaration_statements.Add(String.Format("{0}_ptr = ({1})&{2};",
|
||||
GetDeclarationString(p_array, false),
|
||||
GetDeclarationString(p_array as Type),
|
||||
p.Name));
|
||||
}
|
||||
|
||||
p.QualifiedType = f.WrappedDelegate.Parameters[index].QualifiedType;
|
||||
}
|
||||
|
||||
if (f.ReturnType.WrapperType == WrapperTypes.ConvenienceReturnType ||
|
||||
f.ReturnType.WrapperType == WrapperTypes.ConvenienceArrayReturnType)
|
||||
{
|
||||
var r = f.ReturnType;
|
||||
var p = f.WrappedDelegate.Parameters.Last();
|
||||
if (r.WrapperType == WrapperTypes.ConvenienceArrayReturnType)
|
||||
{
|
||||
var p_size = f.WrappedDelegate.Parameters[f.WrappedDelegate.Parameters.Count - 2];
|
||||
declaration_statements.Add(String.Format(
|
||||
"const {0} = 1;",
|
||||
GetDeclarationString(p_size, false)));
|
||||
}
|
||||
declaration_statements.Add(String.Format("{0} retval;", GetDeclarationString(r)));
|
||||
declaration_statements.Add(String.Format("{0}{2} {1}_ptr = &retval;",
|
||||
GetDeclarationString(r),
|
||||
p.Name,
|
||||
pointer_levels[p.IndirectionLevel]));
|
||||
}
|
||||
|
||||
f.Body.Indent();
|
||||
|
||||
// Automatic OpenGL error checking.
|
||||
// See OpenTK.Graphics.ErrorHelper for more information.
|
||||
// Make sure that no error checking is added to the GetError function,
|
||||
// as that would cause infinite recursion!
|
||||
if ((Settings.Compatibility & Settings.Legacy.NoDebugHelpers) == 0)
|
||||
{
|
||||
if (f.TrimmedName != "GetError")
|
||||
{
|
||||
f.Body.Add("#if DEBUG");
|
||||
f.Body.Add("using (new ErrorHelper(GraphicsContext.CurrentContext))");
|
||||
f.Body.Add("{");
|
||||
if (f.TrimmedName == "Begin")
|
||||
f.Body.Add("GraphicsContext.CurrentContext.ErrorChecking = false;");
|
||||
f.Body.Add("#endif");
|
||||
}
|
||||
}
|
||||
|
||||
bool add_unsafe = !f.Unsafe &&
|
||||
(fixed_statements.Count > 0 || declaration_statements.Count > 0);
|
||||
if (add_unsafe)
|
||||
{
|
||||
f.Body.Add("unsafe");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
if (declaration_statements.Count > 0)
|
||||
{
|
||||
f.Body.AddRange(declaration_statements);
|
||||
}
|
||||
|
||||
if (fixed_statements.Count > 0)
|
||||
{
|
||||
f.Body.AddRange(fixed_statements);
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
if (handle_statements.Count > 0)
|
||||
{
|
||||
f.Body.AddRange(handle_statements);
|
||||
f.Body.Add("try");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
// Hack: When creating untyped enum wrappers, it is possible that the wrapper uses an "All"
|
||||
// enum, while the delegate uses a specific enum (e.g. "TextureUnit"). For this reason, we need
|
||||
// to modify the parameters before generating the call string.
|
||||
// Note: We cannot generate a callstring using WrappedDelegate directly, as its parameters will
|
||||
// typically be different than the parameters of the wrapper. We need to modify the parameters
|
||||
// of the wrapper directly.
|
||||
if ((Settings.Compatibility & Settings.Legacy.KeepUntypedEnums) != 0)
|
||||
{
|
||||
int parameter_index = -1; // Used for comparing wrapper parameters with delegate parameters
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
parameter_index++;
|
||||
if (IsEnum(p.Name, enums) && p.QualifiedType != f.WrappedDelegate.Parameters[parameter_index].QualifiedType)
|
||||
{
|
||||
p.QualifiedType = f.WrappedDelegate.Parameters[parameter_index].QualifiedType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (assign_statements.Count > 0)
|
||||
{
|
||||
// Call function
|
||||
var callstring = GetInvocationString(f);
|
||||
if (func.Parameters.Any(p => p.WrapperType == WrapperTypes.ConvenienceArrayType))
|
||||
{
|
||||
// foo(int id) { foo(1, ref id) }
|
||||
callstring = GetInvocationString(f.WrappedDelegate);
|
||||
f.Body.Add(String.Format("{0}{1};",
|
||||
f.ReturnType.CurrentType.ToLower().Contains("void") ? String.Empty : "return ",
|
||||
callstring));
|
||||
}
|
||||
else if (f.ReturnType.CurrentType.ToLower().Contains("void"))
|
||||
{
|
||||
f.Body.Add(String.Format("{0};", callstring));
|
||||
}
|
||||
else if (func.ReturnType.WrapperType == WrapperTypes.ConvenienceReturnType ||
|
||||
func.ReturnType.WrapperType == WrapperTypes.ConvenienceArrayReturnType)
|
||||
{
|
||||
// int foo() { int value; foo(1, &value); retval = value }
|
||||
callstring = GetInvocationString(f.WrappedDelegate);
|
||||
var p = f.WrappedDelegate.Parameters.Last();
|
||||
f.Body.Add(String.Format("{0};", callstring));
|
||||
f.Body.Add(String.Format(
|
||||
"retval = {0}{1};",
|
||||
pointer_levels[p.IndirectionLevel],
|
||||
p.Name));
|
||||
}
|
||||
else if (func.ReturnType.CurrentType.ToLower().Contains("string"))
|
||||
{
|
||||
f.Body.Add(String.Format("{0} {1} = null; unsafe {{ {1} = new string((sbyte*){2}); }}",
|
||||
func.ReturnType.QualifiedType, "retval", callstring));
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.Add(String.Format("{0} {1} = {2};",
|
||||
GetDeclarationString(f.ReturnType), "retval", callstring));
|
||||
}
|
||||
|
||||
// Assign out parameters
|
||||
f.Body.AddRange(assign_statements);
|
||||
|
||||
// Return
|
||||
if (!f.ReturnType.CurrentType.ToLower().Contains("void"))
|
||||
{
|
||||
f.Body.Add("return retval;");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call function and return
|
||||
var callstring = GetInvocationString(f);
|
||||
if (func.Parameters.Any(p => p.WrapperType == WrapperTypes.ConvenienceArrayType))
|
||||
{
|
||||
// int foo(int id) { return foo(1, ref id) }
|
||||
callstring = GetInvocationString(f.WrappedDelegate);
|
||||
f.Body.Add(String.Format("{0}{1};",
|
||||
f.ReturnType.CurrentType.ToLower().Contains("void") ? String.Empty : "return ",
|
||||
callstring));
|
||||
}
|
||||
else if (f.ReturnType.CurrentType.ToLower().Contains("void"))
|
||||
{
|
||||
f.Body.Add(String.Format("{0};", callstring));
|
||||
}
|
||||
else if (func.ReturnType.WrapperType == WrapperTypes.ConvenienceReturnType ||
|
||||
func.ReturnType.WrapperType == WrapperTypes.ConvenienceArrayReturnType)
|
||||
{
|
||||
// int foo() { int retval; foo(1, &retval); return retval }
|
||||
callstring = GetInvocationString(f.WrappedDelegate);
|
||||
f.Body.Add(String.Format("{0};", callstring));
|
||||
f.Body.Add(String.Format("return retval;"));
|
||||
}
|
||||
else if (func.ReturnType.CurrentType.ToLower().Contains("string"))
|
||||
{
|
||||
f.Body.Add(String.Format("unsafe {{ return new string((sbyte*){0}); }}",
|
||||
callstring));
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.Add(String.Format("return {0};", callstring));
|
||||
}
|
||||
}
|
||||
|
||||
// Free all allocated GCHandles
|
||||
if (handle_statements.Count > 0)
|
||||
{
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
f.Body.Add("finally");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
|
||||
f.Body.AddRange(handle_release_statements);
|
||||
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
|
||||
if (add_unsafe)
|
||||
{
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
|
||||
if (fixed_statements.Count > 0)
|
||||
{
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
|
||||
if ((Settings.Compatibility & Settings.Legacy.NoDebugHelpers) == 0)
|
||||
{
|
||||
if (f.TrimmedName != "GetError")
|
||||
{
|
||||
f.Body.Add("#if DEBUG");
|
||||
if (f.TrimmedName == "End")
|
||||
f.Body.Add("GraphicsContext.CurrentContext.ErrorChecking = true;");
|
||||
f.Body.Add("}");
|
||||
f.Body.Add("#endif");
|
||||
}
|
||||
}
|
||||
|
||||
f.Body.Unindent();
|
||||
|
||||
func.Body = f.Body;
|
||||
}
|
||||
|
||||
string GetDeclarationString(Constant c)
|
||||
{
|
||||
if (String.IsNullOrEmpty(c.Name))
|
||||
|
@ -928,10 +529,11 @@ namespace Bind
|
|||
sb.Append(d.Unsafe ? "unsafe " : "");
|
||||
if (is_delegate)
|
||||
sb.Append("delegate ");
|
||||
sb.Append(GetDeclarationString(d.ReturnType));
|
||||
sb.Append(GetDeclarationString(d.ReturnType, Settings.Legacy.ConstIntEnums));
|
||||
sb.Append(" ");
|
||||
sb.Append(Settings.FunctionPrefix);
|
||||
sb.Append(d.Name);
|
||||
sb.Append(GetDeclarationString(d.Parameters));
|
||||
sb.Append(GetDeclarationString(d.Parameters, Settings.Legacy.ConstIntEnums));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -969,12 +571,12 @@ namespace Bind
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
string GetDeclarationString(Function f)
|
||||
string GetDeclarationString(Function f, Settings.Legacy settings)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append(f.Unsafe ? "unsafe " : "");
|
||||
sb.Append(GetDeclarationString(f.ReturnType));
|
||||
sb.Append(GetDeclarationString(f.ReturnType, settings));
|
||||
sb.Append(" ");
|
||||
if ((Settings.Compatibility & Settings.Legacy.NoTrimFunctionEnding) != Settings.Legacy.None)
|
||||
{
|
||||
|
@ -996,9 +598,12 @@ namespace Bind
|
|||
sb.Remove(sb.Length - 1, 1);
|
||||
sb.Append(">");
|
||||
}
|
||||
sb.AppendLine(GetDeclarationString(f.Parameters));
|
||||
|
||||
sb.Append(GetDeclarationString(f.Parameters, settings));
|
||||
|
||||
if (f.Parameters.HasGenericParameters)
|
||||
{
|
||||
sb.AppendLine();
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
if (p.Generic)
|
||||
|
@ -1006,17 +611,10 @@ namespace Bind
|
|||
}
|
||||
}
|
||||
|
||||
sb.AppendLine("{");
|
||||
foreach (var line in f.Body)
|
||||
{
|
||||
sb.AppendLine(line);
|
||||
}
|
||||
sb.Append("}");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
string GetDeclarationString(Parameter p, bool override_unsafe_setting)
|
||||
string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
@ -1041,12 +639,12 @@ namespace Bind
|
|||
}
|
||||
else
|
||||
{
|
||||
sb.Append(GetDeclarationString(p as Type));
|
||||
sb.Append(GetDeclarationString(p as Type, settings));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(GetDeclarationString(p as Type));
|
||||
sb.Append(GetDeclarationString(p as Type, settings));
|
||||
}
|
||||
if (!String.IsNullOrEmpty(p.Name))
|
||||
{
|
||||
|
@ -1057,7 +655,7 @@ namespace Bind
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
string GetDeclarationString(ParameterCollection parameters)
|
||||
string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
@ -1066,7 +664,7 @@ namespace Bind
|
|||
{
|
||||
foreach (Parameter p in parameters)
|
||||
{
|
||||
sb.Append(GetDeclarationString(p, false));
|
||||
sb.Append(GetDeclarationString(p, false, settings));
|
||||
sb.Append(", ");
|
||||
}
|
||||
sb.Replace(", ", ")", sb.Length - 2, 2);
|
||||
|
@ -1079,112 +677,23 @@ namespace Bind
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
string GetDeclarationString(Type type)
|
||||
string GetDeclarationString(Type type, Settings.Legacy settings)
|
||||
{
|
||||
var t = type.QualifiedType;
|
||||
if ((settings & Settings.Legacy.ConstIntEnums) != 0)
|
||||
{
|
||||
if (type.IsEnum)
|
||||
{
|
||||
t = "System.Int32";
|
||||
}
|
||||
}
|
||||
|
||||
return String.Format("{0}{1}{2}",
|
||||
type.QualifiedType,
|
||||
t,
|
||||
pointer_levels[type.Pointer],
|
||||
array_levels[type.Array]);
|
||||
}
|
||||
|
||||
string GetInvocationString(Delegate d)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append(Settings.DelegatesClass);
|
||||
sb.Append(Settings.NamespaceSeparator);
|
||||
sb.Append(Settings.FunctionPrefix);
|
||||
sb.Append(d.Name);
|
||||
sb.Append(GetInvocationString(d.Parameters));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
string GetInvocationString(ParameterCollection parameters)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append("(");
|
||||
|
||||
if (parameters.Count > 0)
|
||||
{
|
||||
foreach (Parameter p in parameters)
|
||||
{
|
||||
if (p.Unchecked)
|
||||
sb.Append("unchecked((" + p.QualifiedType + ")");
|
||||
|
||||
if (!p.Generic && p.CurrentType != "object")
|
||||
{
|
||||
if (p.CurrentType.ToLower().Contains("string"))
|
||||
{
|
||||
sb.Append(String.Format("({0}{1})",
|
||||
p.QualifiedType, (p.Array > 0) ? "[]" : ""));
|
||||
}
|
||||
else if (p.IndirectionLevel != 0)
|
||||
{
|
||||
if (((Settings.Compatibility & Settings.Legacy.TurnVoidPointersToIntPtr) != Settings.Legacy.None) &&
|
||||
p.Pointer != 0 && p.CurrentType.Contains("void"))
|
||||
{
|
||||
sb.Append("(IntPtr)");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("(");
|
||||
|
||||
sb.Append(p.QualifiedType);
|
||||
for (int i = 0; i < p.IndirectionLevel; i++)
|
||||
sb.Append("*");
|
||||
sb.Append(")");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(String.Format("({0})", p.QualifiedType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (p.WrapperType)
|
||||
{
|
||||
case WrapperTypes.GenericParameter:
|
||||
if (p.Generic)
|
||||
{
|
||||
sb.Append("(IntPtr)");
|
||||
sb.Append(p.Name);
|
||||
sb.Append("_ptr.AddrOfPinnedObject()");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(p.Name);
|
||||
}
|
||||
break;
|
||||
|
||||
case WrapperTypes.ArrayParameter:
|
||||
case WrapperTypes.ReferenceParameter:
|
||||
sb.Append(p.Name);
|
||||
sb.Append("_ptr");
|
||||
break;
|
||||
|
||||
default:
|
||||
sb.Append(p.Name);
|
||||
break;
|
||||
}
|
||||
|
||||
if (p.Unchecked)
|
||||
sb.Append(")");
|
||||
|
||||
sb.Append(", ");
|
||||
}
|
||||
sb.Replace(", ", ")", sb.Length - 2, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(")");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#region License
|
||||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
|
@ -128,11 +128,27 @@ namespace Bind
|
|||
Console.WriteLine("Removing overloaded delegates.");
|
||||
RemoveOverloadedDelegates(delegates, wrappers);
|
||||
|
||||
Console.WriteLine("Generating address table.");
|
||||
GenerateAddressTable(delegates);
|
||||
|
||||
return wrappers;
|
||||
}
|
||||
|
||||
#region Private Members
|
||||
|
||||
static void GenerateAddressTable(DelegateCollection delegates)
|
||||
{
|
||||
int slot = -1;
|
||||
foreach (var list in delegates.Values)
|
||||
{
|
||||
slot++;
|
||||
foreach (var d in list)
|
||||
{
|
||||
d.Slot = slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When we have a list of overloaded delegates, make sure that
|
||||
// all generated wrappers use the first (original) delegate, not
|
||||
// the overloaded ones. This allows us to reduce the amount
|
||||
|
@ -507,17 +523,17 @@ namespace Bind
|
|||
|
||||
TranslateType(d.ReturnType, function_override, nav, enum_processor, enums, d.Category, apiname);
|
||||
|
||||
if (d.ReturnType.CurrentType.ToLower().Contains("void") && d.ReturnType.Pointer != 0)
|
||||
if (d.ReturnType.CurrentType.ToLower() == "void" && d.ReturnType.Pointer != 0)
|
||||
{
|
||||
d.ReturnType.QualifiedType = "IntPtr";
|
||||
d.ReturnType.Pointer--;
|
||||
d.ReturnType.WrapperType = WrapperTypes.GenericReturnType;
|
||||
d.ReturnType.WrapperType |= WrapperTypes.GenericReturnType;
|
||||
}
|
||||
|
||||
if (d.ReturnType.CurrentType.ToLower().Contains("string"))
|
||||
if (d.ReturnType.CurrentType.ToLower() == "string")
|
||||
{
|
||||
d.ReturnType.QualifiedType = "IntPtr";
|
||||
d.ReturnType.WrapperType = WrapperTypes.StringReturnType;
|
||||
d.ReturnType.WrapperType |= WrapperTypes.StringReturnType;
|
||||
}
|
||||
|
||||
if (d.ReturnType.CurrentType.ToLower() == "object")
|
||||
|
@ -563,7 +579,7 @@ namespace Bind
|
|||
{
|
||||
TranslateParameter(d.Parameters[i], function_override, nav, enum_processor, enums, d.Category, apiname);
|
||||
if (d.Parameters[i].CurrentType == "UInt16" && d.Name.Contains("LineStipple"))
|
||||
d.Parameters[i].WrapperType = WrapperTypes.UncheckedParameter;
|
||||
d.Parameters[i].WrapperType |= WrapperTypes.UncheckedParameter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,49 +590,64 @@ namespace Bind
|
|||
{
|
||||
TranslateType(p, function_override, overrides, enum_processor, enums, category, apiname);
|
||||
|
||||
// Find out the necessary wrapper types.
|
||||
if (p.Pointer != 0)/* || CurrentType == "IntPtr")*/
|
||||
// Translate char* -> string. This simplifies the rest of the logic below
|
||||
if (p.CurrentType.ToLower().Contains("char") && p.Pointer > 0)
|
||||
{
|
||||
if (p.CurrentType.ToLower().Contains("string") ||
|
||||
p.CurrentType.ToLower().Contains("char") && p.Pointer > 1)
|
||||
{
|
||||
// string* -> [In] String[] or [Out] StringBuilder[]
|
||||
p.QualifiedType =
|
||||
p.Flow == FlowDirection.Out ?
|
||||
"StringBuilder[]" :
|
||||
"String[]";
|
||||
p.CurrentType = "string";
|
||||
p.Pointer--;
|
||||
}
|
||||
|
||||
p.Pointer = 0;
|
||||
p.WrapperType = WrapperTypes.None;
|
||||
}
|
||||
else if (p.CurrentType.ToLower().Contains("char"))
|
||||
{
|
||||
// char* -> [In] String or [Out] StringBuilder
|
||||
p.QualifiedType =
|
||||
p.Flow == FlowDirection.Out ?
|
||||
"StringBuilder" :
|
||||
"String";
|
||||
// Find out the necessary wrapper types.
|
||||
if (p.CurrentType.ToLower() == "string" && p.Pointer == 0)
|
||||
{
|
||||
// char* -> IntPtr
|
||||
// Due to a bug in the Mono runtime, we need
|
||||
// to marshal [out] string parameters ourselves.
|
||||
// StringBuilder crashes at runtime.
|
||||
// For symmetry, and to avoid potential runtime bugs,
|
||||
// we will also marshal [in] string types manually.
|
||||
p.QualifiedType = "IntPtr";
|
||||
p.WrapperType |= WrapperTypes.StringParameter;
|
||||
}
|
||||
|
||||
p.Pointer = 0;
|
||||
p.WrapperType = WrapperTypes.None;
|
||||
}
|
||||
else if (p.CurrentType.ToLower().Contains("void") ||
|
||||
(!String.IsNullOrEmpty(p.PreviousType) && p.PreviousType.ToLower().Contains("void")))
|
||||
//|| CurrentType.Contains("IntPtr"))
|
||||
if (p.CurrentType.ToLower() == "string" && p.Pointer >= 1)
|
||||
{
|
||||
// string* -> [In] String[]
|
||||
// [Out] StringBuilder[] parameter is not currently supported
|
||||
// Higher indirection levels are also not supported
|
||||
if (p.Flow == FlowDirection.Out)
|
||||
{
|
||||
p.CurrentType = "IntPtr";
|
||||
p.Pointer = 0;
|
||||
p.WrapperType = WrapperTypes.GenericParameter;
|
||||
throw new NotSupportedException("[Out] String* parameters are not currently supported.");
|
||||
}
|
||||
if (p.Pointer >= 2)
|
||||
{
|
||||
throw new NotSupportedException("String arrays with arity >= 2 are not currently supported.");
|
||||
}
|
||||
|
||||
p.QualifiedType = "IntPtr";
|
||||
p.Pointer = 0;
|
||||
p.Array = 0;
|
||||
p.WrapperType |= WrapperTypes.StringArrayParameter;
|
||||
}
|
||||
|
||||
if (p.Pointer > 0 && p.WrapperType == 0)
|
||||
{
|
||||
if (p.QualifiedType.ToLower().StartsWith("void"))
|
||||
{
|
||||
p.QualifiedType = "IntPtr";
|
||||
p.Pointer = 0; // Generic parameters cannot have pointers
|
||||
p.WrapperType |= WrapperTypes.GenericParameter;
|
||||
p.WrapperType |= WrapperTypes.ArrayParameter;
|
||||
p.WrapperType |= WrapperTypes.ReferenceParameter;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.WrapperType = WrapperTypes.ArrayParameter;
|
||||
p.WrapperType |= WrapperTypes.ArrayParameter;
|
||||
p.WrapperType |= WrapperTypes.ReferenceParameter;
|
||||
p.WrapperType |= WrapperTypes.PointerParameter;
|
||||
}
|
||||
}
|
||||
|
||||
if (p.Reference)
|
||||
p.WrapperType |= WrapperTypes.ReferenceParameter;
|
||||
|
||||
if (Utilities.Keywords(Settings.Language).Contains(p.Name))
|
||||
p.Name = Settings.KeywordEscapeCharacter + p.Name;
|
||||
|
||||
|
@ -880,14 +911,9 @@ namespace Bind
|
|||
|
||||
if (f != null)
|
||||
{
|
||||
// If we have a convenience overload, we should turn its name from
|
||||
// plural into singular
|
||||
if (f.ReturnType.WrapperType == WrapperTypes.ConvenienceReturnType ||
|
||||
f.ReturnType.WrapperType == WrapperTypes.ConvenienceArrayReturnType ||
|
||||
f.Parameters.Any(t => t.WrapperType == WrapperTypes.ConvenienceArrayType))
|
||||
{
|
||||
f.TrimmedName = f.TrimmedName.Replace("Queries", "Query").TrimEnd('s');
|
||||
}
|
||||
// If we have a convenience overload, we should turn its name from plural into singular
|
||||
f.TrimmedName = f.TrimmedName.Replace("Queries", "Query").TrimEnd('s');
|
||||
|
||||
convenience_wrappers.Add(f);
|
||||
}
|
||||
}
|
||||
|
@ -901,7 +927,7 @@ namespace Bind
|
|||
f.ReturnType = new Type(f.Parameters.Last());
|
||||
f.ReturnType.Pointer = 0;
|
||||
f.Parameters.RemoveAt(f.Parameters.Count - 1);
|
||||
f.ReturnType.WrapperType = WrapperTypes.ConvenienceReturnType;
|
||||
f.ReturnType.WrapperType |= WrapperTypes.ConvenienceReturnType;
|
||||
|
||||
if (f.Parameters.Count > 0)
|
||||
{
|
||||
|
@ -909,7 +935,7 @@ namespace Bind
|
|||
if (p_size.CurrentType.ToLower().StartsWith("int") && p_size.Pointer == 0)
|
||||
{
|
||||
f.Parameters.RemoveAt(f.Parameters.Count - 1);
|
||||
f.ReturnType.WrapperType = WrapperTypes.ConvenienceArrayReturnType;
|
||||
f.ReturnType.WrapperType |= WrapperTypes.ConvenienceArrayReturnType;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
|
@ -921,172 +947,228 @@ namespace Bind
|
|||
var p_array = f.Parameters.Last();
|
||||
var p_size = f.Parameters[f.Parameters.Count - 2];
|
||||
f.Parameters.RemoveAt(f.Parameters.Count - 2);
|
||||
p_array.WrapperType = WrapperTypes.ConvenienceArrayType;
|
||||
p_array.Pointer = 0;
|
||||
p_array.WrapperType |= WrapperTypes.ConvenienceArrayType;
|
||||
// Since this is a 1-element overload, we don't need
|
||||
// array or reference wrappers.
|
||||
p_array.WrapperType &= ~(
|
||||
WrapperTypes.ReferenceParameter |
|
||||
WrapperTypes.ArrayParameter);
|
||||
p_array.Array = p_array.Pointer = 0;
|
||||
p_array.Reference = false;
|
||||
return f;
|
||||
}
|
||||
|
||||
List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw)
|
||||
{
|
||||
if (!dictionary.ContainsKey(key))
|
||||
{
|
||||
dictionary.Add(key, new List<Function>());
|
||||
if (raw != null)
|
||||
{
|
||||
dictionary[key].Add(new Function(raw));
|
||||
}
|
||||
}
|
||||
return dictionary[key];
|
||||
}
|
||||
|
||||
public IEnumerable<Function> WrapParameters(Function func, EnumCollection enums)
|
||||
{
|
||||
Function f;
|
||||
|
||||
if (func.Parameters.HasPointerParameters)
|
||||
if (func.Parameters.Count == 0)
|
||||
{
|
||||
Function _this = new Function(func);
|
||||
// Array overloads
|
||||
foreach (Parameter p in _this.Parameters)
|
||||
// Functions without parameters do not need
|
||||
// parameter wrappers
|
||||
yield return func;
|
||||
yield break;
|
||||
}
|
||||
|
||||
var wrappers = new Dictionary<WrapperTypes, List<Function>>();
|
||||
for (int i = 0; i < func.Parameters.Count; i++)
|
||||
{
|
||||
var parameter = func.Parameters[i];
|
||||
|
||||
// Handle all non-generic parameters first.
|
||||
// Generics are handled in a second pass.
|
||||
if ((parameter.WrapperType & WrapperTypes.GenericParameter) == 0)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.ArrayParameter)
|
||||
if ((parameter.WrapperType & WrapperTypes.ArrayParameter) != 0)
|
||||
{
|
||||
if (p.ElementCount != 1)
|
||||
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.ArrayParameter, func))
|
||||
{
|
||||
// Create a proper array
|
||||
p.Reference = false;
|
||||
p.Array++;
|
||||
var p = wrapper.Parameters[i];
|
||||
|
||||
if (p.ElementCount == 1)
|
||||
{
|
||||
p.Reference = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Array++;
|
||||
}
|
||||
p.Pointer--;
|
||||
}
|
||||
}
|
||||
|
||||
if ((parameter.WrapperType & WrapperTypes.ReferenceParameter) != 0)
|
||||
{
|
||||
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.ReferenceParameter, func))
|
||||
{
|
||||
var p = wrapper.Parameters[i];
|
||||
|
||||
p.Reference = true;
|
||||
p.Pointer--;
|
||||
}
|
||||
}
|
||||
|
||||
if ((parameter.WrapperType & WrapperTypes.PointerParameter) != 0)
|
||||
{
|
||||
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.PointerParameter, func))
|
||||
{
|
||||
var p = wrapper.Parameters[i];
|
||||
|
||||
if (Settings.IsEnabled(Settings.Legacy.NoPublicUnsafeFunctions))
|
||||
{
|
||||
p.QualifiedType = "IntPtr";
|
||||
p.Pointer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parameter.WrapperType == 0 ||
|
||||
(parameter.WrapperType & WrapperTypes.ConvenienceArrayType) != 0 ||
|
||||
(parameter.WrapperType & WrapperTypes.ConvenienceReturnType) != 0 ||
|
||||
(parameter.WrapperType & WrapperTypes.ConvenienceArrayReturnType) != 0)
|
||||
{
|
||||
// We don't need to do anything, just add this function directly
|
||||
// to the list of wrappers.
|
||||
GetWrapper(wrappers, parameter.WrapperType, func);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle generic parameters
|
||||
if (wrappers.Count == 0)
|
||||
{
|
||||
// Some functions, such as VDPAUInit, only have generic parameters
|
||||
// This means no wrapper has been generated by any of the previous
|
||||
// transformations. Since the generic translation below operates on
|
||||
// existing wrappers, add one here to get the process started.
|
||||
wrappers.Add(WrapperTypes.None, new List<Function> { new Function(func) });
|
||||
}
|
||||
var list = new List<Function>();
|
||||
foreach (var wrapper in wrappers.Values.SelectMany(v => v))
|
||||
{
|
||||
// Add generic 'ref T' wrapper
|
||||
Function generic_wrapper = null;
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var parameter = wrapper.Parameters[i];
|
||||
if ((parameter.WrapperType & WrapperTypes.GenericParameter) != 0)
|
||||
{
|
||||
generic_wrapper = generic_wrapper ?? new Function(wrapper);
|
||||
var p = generic_wrapper.Parameters[i];
|
||||
|
||||
p.Reference = true;
|
||||
p.Pointer = 0;
|
||||
p.Array = 0;
|
||||
p.Generic = true;
|
||||
p.QualifiedType = "T" + i.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
}
|
||||
}
|
||||
if (generic_wrapper != null)
|
||||
{
|
||||
list.Add(generic_wrapper);
|
||||
}
|
||||
|
||||
// Add the following wrappers:
|
||||
// 'IntPtr', 'T[]', 'T[,]' and 'T[,,]'
|
||||
for (int arity = 0; arity < 4; arity++)
|
||||
{
|
||||
generic_wrapper = null;
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var parameter = wrapper.Parameters[i];
|
||||
if ((parameter.WrapperType & WrapperTypes.GenericParameter) != 0)
|
||||
{
|
||||
generic_wrapper = generic_wrapper ?? new Function(wrapper);
|
||||
var p = generic_wrapper.Parameters[i];
|
||||
|
||||
p.Reference = false;
|
||||
p.Pointer = 0;
|
||||
p.Array = arity;
|
||||
if (arity == 0)
|
||||
{
|
||||
p.QualifiedType = "IntPtr";
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Generic = true;
|
||||
p.QualifiedType = "T" + i.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (generic_wrapper != null)
|
||||
{
|
||||
list.Add(generic_wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
GetWrapper(wrappers, WrapperTypes.GenericParameter, null)
|
||||
.AddRange(list);
|
||||
|
||||
// Handle string parameters
|
||||
foreach (var wrapper in wrappers.Values.SelectMany(v => v))
|
||||
{
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var p = wrapper.Parameters[i];
|
||||
if ((p.WrapperType & WrapperTypes.StringParameter) != 0)
|
||||
{
|
||||
if (p.Flow == FlowDirection.Out)
|
||||
{
|
||||
p.QualifiedType = "StringBuilder";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a reference
|
||||
p.Reference = true;
|
||||
p.Array--;
|
||||
p.Pointer--;
|
||||
p.WrapperType = WrapperTypes.ReferenceParameter;
|
||||
p.QualifiedType = "String";
|
||||
}
|
||||
}
|
||||
|
||||
if ((p.WrapperType & WrapperTypes.StringArrayParameter) != 0)
|
||||
{
|
||||
if (p.Flow == FlowDirection.Out)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.QualifiedType = "String";
|
||||
p.Pointer = 0;
|
||||
p.Array = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
f = new Function(_this);
|
||||
yield return f;
|
||||
foreach (var w in WrapVoidPointers(f, enums))
|
||||
yield return w;
|
||||
|
||||
_this = new Function(func);
|
||||
// Reference overloads
|
||||
foreach (Parameter p in _this.Parameters)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.ArrayParameter)
|
||||
{
|
||||
p.Reference = true;
|
||||
p.Array--;
|
||||
p.Pointer--;
|
||||
p.WrapperType = WrapperTypes.ReferenceParameter;
|
||||
}
|
||||
}
|
||||
f = new Function(_this);
|
||||
yield return f;
|
||||
foreach (var w in WrapVoidPointers(f, enums))
|
||||
yield return w;
|
||||
|
||||
_this = func;
|
||||
// Pointer overloads
|
||||
// Should be last to work around an Intellisense bug, where
|
||||
// array overloads are not reported if there is a pointer overload.
|
||||
foreach (Parameter p in _this.Parameters)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.ArrayParameter)
|
||||
{
|
||||
p.Reference = false;
|
||||
p.WrapperType = WrapperTypes.PointerParameter;
|
||||
}
|
||||
}
|
||||
f = new Function(_this);
|
||||
yield return f;
|
||||
foreach (var w in WrapVoidPointers(f, enums))
|
||||
yield return w;
|
||||
}
|
||||
else
|
||||
|
||||
// Return all generated wrappers
|
||||
foreach (var w in wrappers.Values.SelectMany(v => v).OrderBy(v => v))
|
||||
{
|
||||
f = new Function(func);
|
||||
yield return f;
|
||||
yield return w;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<Function> WrapVoidPointers(Function f, EnumCollection enums)
|
||||
{
|
||||
// reference wrapper (e.g. void Foo<T1,T2>(int, ref T1, ref T2))
|
||||
var func = new Function(f);
|
||||
int index = -1;
|
||||
foreach (var p in func.Parameters)
|
||||
{
|
||||
index++;
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
p.Reference = true;
|
||||
p.Array = 0;
|
||||
p.Pointer = 0;
|
||||
p.Generic = true;
|
||||
p.CurrentType = "T" + index.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
func.Parameters.Rebuild = true;
|
||||
}
|
||||
}
|
||||
yield return func;
|
||||
|
||||
// 1d-array wrapper (e.g. void Foo<T1, T2>(int, T1[], T2[]))
|
||||
func = new Function(f);
|
||||
index = -1;
|
||||
foreach (var p in func.Parameters)
|
||||
{
|
||||
index++;
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
p.Reference = false;
|
||||
p.Array = 1;
|
||||
p.Pointer = 0;
|
||||
p.Generic = true;
|
||||
p.CurrentType = "T" + index.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
func.Parameters.Rebuild = true;
|
||||
}
|
||||
}
|
||||
yield return func;
|
||||
|
||||
// 2d-array wrapper (e.g. void Foo<T1, T2>(int, T1[,], T2[,]))
|
||||
func = new Function(f);
|
||||
index = -1;
|
||||
foreach (var p in func.Parameters)
|
||||
{
|
||||
index++;
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
p.Reference = false;
|
||||
p.Array = 2;
|
||||
p.Pointer = 0;
|
||||
p.Generic = true;
|
||||
p.CurrentType = "T" + index.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
func.Parameters.Rebuild = true;
|
||||
}
|
||||
}
|
||||
yield return func;
|
||||
|
||||
// 3d-array wrapper (e.g. void Foo<T1, T2>(int, T1[,,], T2[,,]))
|
||||
func = new Function(f);
|
||||
index = -1;
|
||||
foreach (var p in func.Parameters)
|
||||
{
|
||||
index++;
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
p.Reference = false;
|
||||
p.Array = 3;
|
||||
p.Pointer = 0;
|
||||
p.Generic = true;
|
||||
p.CurrentType = "T" + index.ToString();
|
||||
p.Flow = FlowDirection.Undefined;
|
||||
func.Parameters.Rebuild = true;
|
||||
}
|
||||
}
|
||||
yield return func;
|
||||
}
|
||||
|
||||
static void WrapReturnType(Function func)
|
||||
{
|
||||
switch (func.ReturnType.WrapperType)
|
||||
if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0)
|
||||
{
|
||||
case WrapperTypes.StringReturnType:
|
||||
func.ReturnType.QualifiedType = "String";
|
||||
break;
|
||||
func.ReturnType.QualifiedType = "String";
|
||||
}
|
||||
|
||||
if ((func.ReturnType.WrapperType & WrapperTypes.GenericReturnType) != 0)
|
||||
{
|
||||
// Nothing else we can do, using generics will break the runtime
|
||||
func.ReturnType.QualifiedType = "IntPtr";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,12 +46,10 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Debug\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -63,11 +61,9 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -79,11 +75,9 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -91,7 +85,7 @@
|
|||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<DebugType>none</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -1049,4 +1043,18 @@
|
|||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
|
||||
<CSharpFormattingPolicy IndentSwitchBody="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ElseNewLinePlacement="NewLine" CatchNewLinePlacement="NewLine" FinallyNewLinePlacement="NewLine" WhileNewLinePlacement="NewLine" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" BlankLinesBeforeFirstDeclaration="1" AlignToFirstMethodDeclarationParameter="False" AlignToFirstIndexerDeclarationParameter="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
<TextStylePolicy FileWidth="120" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<StandardHeader Text="#region License

${FileName}
 
Author:
 ${AuthorName} <${AuthorEmail}>

Copyright (c) 2006-${Year} ${CopyrightHolder}

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" IncludeInNewFiles="True" />
|
||||
<TextStylePolicy TabWidth="2" IndentWidth="2" NoTabsAfterNonTabs="True" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
|
||||
<XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -53,6 +53,7 @@ namespace Bind.Structures
|
|||
DeprecatedVersion = d.DeprecatedVersion;
|
||||
EntryPoint = d.EntryPoint;
|
||||
Obsolete = d.Obsolete;
|
||||
Slot = d.Slot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -242,6 +243,9 @@ namespace Bind.Structures
|
|||
public string EntryPoint { get; set; }
|
||||
public string Obsolete { get; set; }
|
||||
|
||||
// Slot index in the address table
|
||||
public int Slot { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
// This method should only be used for debugging purposes, not for code generation!
|
||||
|
|
|
@ -27,60 +27,68 @@ namespace Bind
|
|||
/// <summary>
|
||||
/// Function takes bool parameter - C uses Int for bools, so we have to marshal.
|
||||
/// </summary>
|
||||
BoolParameter,
|
||||
BoolParameter = 1 << 0,
|
||||
/// <summary>
|
||||
/// Function takes generic parameters - add ref/out generic and generic overloads.
|
||||
/// </summary>
|
||||
GenericParameter,
|
||||
GenericParameter = 1 << 1,
|
||||
/// <summary>
|
||||
/// Function takes arrays as parameters - add ref/out and ([Out]) array overloads.
|
||||
/// </summary>
|
||||
ArrayParameter,
|
||||
ArrayParameter = 1 << 2,
|
||||
/// <summary>
|
||||
/// Function with bitmask parameters. Bitmask parameters map to UInt, but since we can only use signed
|
||||
/// types (for CLS compliance), we must add the unchecked keyword.
|
||||
/// Usually found in bitmasks
|
||||
/// </summary>
|
||||
UncheckedParameter,
|
||||
UncheckedParameter = 1 << 3,
|
||||
/// <summary>
|
||||
/// Function that takes (in/ref/out) a naked pointer as a parameter - we pass an IntPtr.
|
||||
/// </summary>
|
||||
PointerParameter,
|
||||
PointerParameter = 1 << 4,
|
||||
/// <summary>
|
||||
/// Function that takes a reference to a struct.
|
||||
/// </summary>
|
||||
ReferenceParameter,
|
||||
ReferenceParameter = 1 << 5,
|
||||
/// <summary>
|
||||
/// Function returns string - needs manual marshalling through IntPtr to prevent the managed GC
|
||||
/// from freeing memory allocated on the unmanaged side (e.g. glGetString).
|
||||
/// </summary>
|
||||
StringReturnType,
|
||||
StringReturnType = 1 << 6,
|
||||
/// <summary>
|
||||
/// Function returns a void pointer - maps to IntPtr, and the user has to manually marshal the type.
|
||||
/// </summary>
|
||||
GenericReturnType,
|
||||
GenericReturnType = 1 << 7,
|
||||
/// <summary>
|
||||
/// Function returns a typed pointer - we have to copy the data to an array to protect it from the GC.
|
||||
/// </summary>
|
||||
ArrayReturnType,
|
||||
ArrayReturnType = 1 << 8,
|
||||
/// <summary>
|
||||
/// Function normally returns a value via an out parameter.
|
||||
/// This overload returns a single item directly.
|
||||
/// e.g. void GetIntegerv(enum pname, out int value) => int GetInteger(enum pname)
|
||||
/// </summary>
|
||||
ConvenienceReturnType,
|
||||
ConvenienceReturnType = 1 << 9,
|
||||
/// <summary>
|
||||
/// Function normally returns an array via an out parameter.
|
||||
/// This overload returns a single item directly.
|
||||
/// e.g. void GenBuffers(int count, int[] ids) => int GenBuffer()
|
||||
/// </summary>
|
||||
ConvenienceArrayReturnType,
|
||||
ConvenienceArrayReturnType = 1 << 10,
|
||||
/// <summary>
|
||||
/// Function normally takes an array in parameter.
|
||||
/// This overload takes a single item directly.
|
||||
/// e.g. void DeleteBuffers(int count, int[] ids) => DeleteBuffer(int id)
|
||||
/// </summary>
|
||||
ConvenienceArrayType,
|
||||
ConvenienceArrayType = 1 << 11,
|
||||
/// <summary>
|
||||
/// Function takes a String or StringBuilder parameter
|
||||
/// </summary>
|
||||
StringParameter = 1 << 12,
|
||||
/// <summary>
|
||||
/// Function takes a String[] parameter
|
||||
/// </summary>
|
||||
StringArrayParameter = 1 << 13,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Documentation'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Debug</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Nsis'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{75DC22B1-113F-4A66-96B9-2FF8208C10E8}</ProjectGuid>
|
||||
<AssemblyName>Build.UpdateVersion</AssemblyName>
|
||||
|
@ -31,6 +11,32 @@
|
|||
<ProductVersion>10.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Documentation' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<OutputPath>..\..\Binaries\Tools\Debug\</OutputPath>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Nsis' ">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -44,23 +50,6 @@
|
|||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Documentation|AnyCPU' ">
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Nsis|AnyCPU' ">
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<Target Name="BeforeBuild">
|
||||
<Delete Files="..\..\Timestamp.txt" />
|
||||
<Delete Files="..\..\Version.txt" />
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
|
@ -66,8 +64,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
@ -76,7 +72,8 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>0219, 0414, 0612, 0618, 1591, 3005, 3006</NoWarn>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DebugType>none</DebugType>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
@ -92,8 +89,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
|
@ -45,12 +45,10 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Debug\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Debug\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -63,11 +61,9 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
@ -75,7 +71,7 @@
|
|||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<DebugType>none</DebugType>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -86,11 +82,9 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
|
|
@ -49,8 +49,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
|
@ -67,8 +65,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
@ -76,7 +72,8 @@
|
|||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DebugType>none</DebugType>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
@ -91,8 +88,6 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
|
||||
|
|
91
Source/Generator.Rewrite/Generator.Rewrite.csproj
Normal file
91
Source/Generator.Rewrite/Generator.Rewrite.csproj
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C426C9D1-8857-4E52-BAC7-4C05EE6070AB}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OpenTK.Rewrite</RootNamespace>
|
||||
<AssemblyName>Rewrite</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProductVersion>12.0.0</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Binaries\Tools\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Commandlineparameters>../../OpenTK/Debug/OpenTK.dll ../../../OpenTK.snk</Commandlineparameters>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Binaries\Tools\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Commandlineparameters>../../OpenTK/Release/OpenTK.dll ../../../OpenTK.snk</Commandlineparameters>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Cecil">
|
||||
<HintPath>..\..\Dependencies\managed\Mono.Cecil.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Mdb">
|
||||
<HintPath>..\..\Dependencies\managed\Mono.Cecil.Mdb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Pdb">
|
||||
<HintPath>..\..\Dependencies\managed\Mono.Cecil.Pdb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil.Rocks">
|
||||
<HintPath>..\..\Dependencies\managed\Mono.Cecil.Rocks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\OpenTK.snk">
|
||||
<Link>OpenTK.snk</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
|
||||
<CSharpFormattingPolicy IndentSwitchBody="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ElseNewLinePlacement="NewLine" CatchNewLinePlacement="NewLine" FinallyNewLinePlacement="NewLine" WhileNewLinePlacement="NewLine" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" BlankLinesBeforeFirstDeclaration="1" AlignToFirstMethodDeclarationParameter="False" AlignToFirstIndexerDeclarationParameter="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
<TextStylePolicy FileWidth="120" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<StandardHeader Text="#region License

${FileName}
 
Author:
 ${AuthorName} <${AuthorEmail}>

Copyright (c) 2006-${Year} ${CopyrightHolder}

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" IncludeInNewFiles="True" />
|
||||
<TextStylePolicy TabWidth="2" IndentWidth="2" NoTabsAfterNonTabs="True" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
|
||||
<XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
635
Source/Generator.Rewrite/Program.cs
Normal file
635
Source/Generator.Rewrite/Program.cs
Normal file
|
@ -0,0 +1,635 @@
|
|||
// OpenTK.Rewrite: IL rewriter for OpenTK.dll
|
||||
// Copyright (C) 2013 Stefanos Apostolopoulos
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using Mono.Cecil.Rocks;
|
||||
|
||||
namespace OpenTK.Rewrite
|
||||
{
|
||||
// Replaces OpenTK.InteropHelper method instances
|
||||
// with the s IL instructions.
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Usage: rewrite [file.dll] [file.snk]");
|
||||
return;
|
||||
}
|
||||
|
||||
var program = new Program();
|
||||
var file = args[0];
|
||||
var key = args.Length >= 2 ? args[1] : null;
|
||||
program.Rewrite(file, key);
|
||||
}
|
||||
|
||||
// mscorlib types
|
||||
static AssemblyDefinition mscorlib;
|
||||
static TypeDefinition TypeMarshal;
|
||||
static TypeDefinition TypeStringArray;
|
||||
static TypeDefinition TypeStringBuilder;
|
||||
static TypeDefinition TypeVoid;
|
||||
static TypeDefinition TypeIntPtr;
|
||||
|
||||
// OpenTK.BindingsBase
|
||||
static TypeDefinition TypeBindingsBase;
|
||||
|
||||
void Rewrite(string file, string keyfile)
|
||||
{
|
||||
// Specify assembly read and write parameters
|
||||
// We want to keep a valid symbols file (pdb or mdb)
|
||||
var read_params = new ReaderParameters();
|
||||
var write_params = new WriterParameters();
|
||||
var pdb = Path.ChangeExtension(file, "pdb");
|
||||
var mdb = Path.ChangeExtension(file, "mdb");
|
||||
ISymbolReaderProvider provider = null;
|
||||
if (File.Exists(pdb))
|
||||
{
|
||||
provider = new Mono.Cecil.Pdb.PdbReaderProvider();
|
||||
}
|
||||
else if (File.Exists(mdb))
|
||||
{
|
||||
provider = new Mono.Cecil.Mdb.MdbReaderProvider();
|
||||
}
|
||||
read_params.SymbolReaderProvider = provider;
|
||||
read_params.ReadSymbols = true;
|
||||
write_params.WriteSymbols = true;
|
||||
|
||||
if (!String.IsNullOrEmpty(keyfile) && File.Exists(keyfile))
|
||||
{
|
||||
keyfile = Path.GetFullPath(keyfile);
|
||||
var fs = new FileStream(keyfile, FileMode.Open);
|
||||
var keypair = new System.Reflection.StrongNameKeyPair(fs);
|
||||
fs.Close();
|
||||
write_params.StrongNameKeyPair = keypair;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("No keyfile specified or keyfile missing.");
|
||||
}
|
||||
|
||||
// Load assembly and process all modules
|
||||
var assembly = AssemblyDefinition.ReadAssembly(file, read_params);
|
||||
var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute");
|
||||
if (rewritten == null)
|
||||
{
|
||||
foreach (var module in assembly.Modules)
|
||||
{
|
||||
foreach (var reference in module.AssemblyReferences)
|
||||
{
|
||||
var resolved = module.AssemblyResolver.Resolve(reference);
|
||||
if (reference.Name == "mscorlib")
|
||||
{
|
||||
mscorlib = resolved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mscorlib == null)
|
||||
{
|
||||
Console.Error.WriteLine("Failed to locate mscorlib");
|
||||
return;
|
||||
}
|
||||
TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal");
|
||||
TypeStringArray = mscorlib.MainModule.GetType("System.String").MakeArrayType().Resolve();
|
||||
TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder");
|
||||
TypeVoid = mscorlib.MainModule.GetType("System.Void");
|
||||
TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr");
|
||||
|
||||
TypeBindingsBase = assembly.Modules.Select(m => m.GetType("OpenTK.BindingsBase")).First();
|
||||
|
||||
foreach (var module in assembly.Modules)
|
||||
{
|
||||
foreach (var type in module.Types)
|
||||
{
|
||||
Rewrite(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("Error: assembly has already been rewritten");
|
||||
}
|
||||
|
||||
// Save rewritten assembly
|
||||
assembly.Write(file, write_params);
|
||||
}
|
||||
|
||||
void Rewrite(TypeDefinition type)
|
||||
{
|
||||
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
|
||||
if (entry_points != null)
|
||||
{
|
||||
// Build list of entry point signatures (one per entry point)
|
||||
var entry_signatures = new List<MethodDefinition>();
|
||||
entry_signatures.AddRange(type.Methods
|
||||
.Where(t => t.CustomAttributes.Any(a => a.AttributeType.Name == "SlotAttribute")));
|
||||
|
||||
Rewrite(type, entry_points, entry_signatures);
|
||||
|
||||
RemoveNativeSignatures(type, entry_signatures);
|
||||
}
|
||||
|
||||
if (type.Name == "RewrittenAttribute")
|
||||
{
|
||||
var rewritten_constructor = type.GetConstructors().First();
|
||||
var rewritten = new CustomAttribute(rewritten_constructor);
|
||||
rewritten.ConstructorArguments.Add(new CustomAttributeArgument(
|
||||
type.Module.Import(mscorlib.MainModule.GetType("System.Boolean")), true));
|
||||
type.Module.Assembly.CustomAttributes.Add(rewritten);
|
||||
}
|
||||
}
|
||||
|
||||
void Rewrite(TypeDefinition type, FieldDefinition entry_points,
|
||||
List<MethodDefinition> entry_signatures)
|
||||
{
|
||||
// Rewrite all wrapper methods
|
||||
var wrapper_signatures = new List<MethodDefinition>();
|
||||
wrapper_signatures.AddRange(type.Methods
|
||||
.Where(m => m.IsPublic && m.CustomAttributes.Any(a => a.AttributeType.Name == "AutoGeneratedAttribute")));
|
||||
|
||||
foreach (var wrapper in wrapper_signatures)
|
||||
{
|
||||
var autogenerated = wrapper.CustomAttributes
|
||||
.Where(a => a.AttributeType.Name == "AutoGeneratedAttribute");
|
||||
if (autogenerated.Count() > 0)
|
||||
{
|
||||
var signature_name = (string)autogenerated.First()
|
||||
.Fields.First(f => f.Name == "EntryPoint").Argument.Value;
|
||||
var signature = entry_signatures.First(s => s.Name == signature_name);
|
||||
var slot = (int)signature.CustomAttributes
|
||||
.First(a => a.AttributeType.Name == "SlotAttribute")
|
||||
.ConstructorArguments[0].Value;
|
||||
|
||||
ProcessMethod(wrapper, signature, slot, entry_points);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveSupportingAttributes(type);
|
||||
|
||||
if (type.NestedTypes.Count > 0)
|
||||
{
|
||||
foreach (var nested_type in type.NestedTypes)
|
||||
{
|
||||
Rewrite(nested_type, entry_points, entry_signatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveNativeSignatures(TypeDefinition type, List<MethodDefinition> methods)
|
||||
{
|
||||
while (methods.Count > 0)
|
||||
{
|
||||
type.Methods.Remove(methods.Last());
|
||||
methods.RemoveAt(methods.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveSupportingAttributes(TypeDefinition type)
|
||||
{
|
||||
foreach (var method in type.Methods)
|
||||
{
|
||||
var attr = method.CustomAttributes;
|
||||
for (int i = 0; i < attr.Count; i++)
|
||||
{
|
||||
if (attr[i].AttributeType.Name == "AutoGeneratedAttribute")
|
||||
{
|
||||
attr.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create body for method
|
||||
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot, FieldDefinition entry_points)
|
||||
{
|
||||
var body = wrapper.Body;
|
||||
var il = body.GetILProcessor();
|
||||
var instructions = body.Instructions;
|
||||
instructions.Clear();
|
||||
|
||||
// Declare pinned variables for every reference and array parameter
|
||||
// and push each parameter on the stack
|
||||
|
||||
// Patch convenience wrappers
|
||||
if (wrapper.Parameters.Count == native.Parameters.Count)
|
||||
{
|
||||
EmitParameters(wrapper, body, il);
|
||||
}
|
||||
else
|
||||
{
|
||||
int difference = native.Parameters.Count - wrapper.Parameters.Count;
|
||||
EmitConvenienceWrapper(wrapper, native, difference, body, il);
|
||||
}
|
||||
|
||||
// push the entry point address on the stack
|
||||
EmitEntryPoint(entry_points, il, slot);
|
||||
|
||||
// issue calli
|
||||
EmitCall(il, native);
|
||||
|
||||
if (wrapper.ReturnType.Name != "Void")
|
||||
{
|
||||
EmitReturnTypeWrapper(wrapper, native, body, il);
|
||||
}
|
||||
if (wrapper.Parameters.Any(p => p.ParameterType.Name == "StringBuilder"))
|
||||
{
|
||||
EmitStringBuilderEpilogue(wrapper, native, body, il);
|
||||
}
|
||||
if (wrapper.Parameters.Any(p => p.ParameterType.Name == "String" && p.ParameterType.IsArray))
|
||||
{
|
||||
EmitStringArrayEpilogue(wrapper, body, il);
|
||||
}
|
||||
if (wrapper.Parameters.Any(p => p.ParameterType.Name == "String" && !p.ParameterType.IsArray))
|
||||
{
|
||||
EmitStringEpilogue(wrapper, body, il);
|
||||
}
|
||||
|
||||
// return
|
||||
il.Emit(OpCodes.Ret);
|
||||
|
||||
if (body.Variables.Count > 0)
|
||||
{
|
||||
// Required for verifiable executables
|
||||
// (otherwise peverify complains bitterly)
|
||||
body.InitLocals = true;
|
||||
}
|
||||
body.OptimizeMacros();
|
||||
}
|
||||
|
||||
private static void EmitReturnTypeWrapper(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il)
|
||||
{
|
||||
if (wrapper.Parameters.Count < native.Parameters.Count)
|
||||
{
|
||||
// Convenience wrapper. The result is stored in the last local variable
|
||||
il.Emit(OpCodes.Ldloc, body.Variables.Count - 1);
|
||||
}
|
||||
else if (wrapper.ReturnType != native.ReturnType)
|
||||
{
|
||||
if (wrapper.ReturnType.Name == "String")
|
||||
{
|
||||
// String return-type wrapper
|
||||
// return new string((sbyte*)((void*)GetString()));
|
||||
|
||||
var intptr_to_voidpointer = wrapper.Module.Import(mscorlib.MainModule.GetType("System.IntPtr").GetMethods()
|
||||
.First(m =>
|
||||
{
|
||||
return
|
||||
m.Name == "op_Explicit" &&
|
||||
m.ReturnType.Name == "Void*";
|
||||
}));
|
||||
|
||||
var string_constructor = wrapper.Module.Import(mscorlib.MainModule.GetType("System.String").GetConstructors()
|
||||
.First(m =>
|
||||
{
|
||||
var p = m.Parameters;
|
||||
return p.Count > 0 && p[0].ParameterType.Name == "SByte*";
|
||||
}));
|
||||
|
||||
il.Emit(OpCodes.Call, intptr_to_voidpointer);
|
||||
il.Emit(OpCodes.Newobj, string_constructor);
|
||||
}
|
||||
else if (wrapper.ReturnType.Resolve().IsEnum)
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("Return wrapper for '{1}' not implemented yet ({0})", native.Name, wrapper.ReturnType.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing to do, the native call leaves the return value
|
||||
// on the stack and we return that unmodified to the caller.
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il)
|
||||
{
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var p = wrapper.Parameters[i].ParameterType;
|
||||
if (p.Name == "StringBuilder")
|
||||
{
|
||||
// void GetShaderInfoLog(..., StringBuilder foo)
|
||||
// try {
|
||||
// foo_sb_ptr = Marshal.AllocHGlobal(sb.Capacity + 1); -- already emitted
|
||||
// glGetShaderInfoLog(..., foo_sb_ptr); -- already emitted
|
||||
// MarshalPtrToStringBuilder(foo_sb_ptr, foo);
|
||||
// }
|
||||
// finally {
|
||||
// Marshal.FreeHGlobal(foo_sb_ptr);
|
||||
// }
|
||||
|
||||
// Make sure we have imported BindingsBase::MasrhalPtrToStringBuilder and Marshal::FreeHGlobal
|
||||
var ptr_to_sb = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalPtrToStringBuilder"));
|
||||
var free_hglobal = wrapper.Module.Import(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal"));
|
||||
|
||||
var block = new ExceptionHandler(ExceptionHandlerType.Finally);
|
||||
block.TryStart = body.Instructions[0];
|
||||
|
||||
var variable_name = p.Name + " _sb_ptr";
|
||||
var v = body.Variables.First(m => m.Name == variable_name);
|
||||
il.Emit(OpCodes.Ldloc, v.Index);
|
||||
il.Emit(OpCodes.Ldarg, i);
|
||||
il.Emit(OpCodes.Call, ptr_to_sb);
|
||||
|
||||
block.TryEnd = body.Instructions.Last();
|
||||
block.HandlerStart = body.Instructions.Last();
|
||||
|
||||
il.Emit(OpCodes.Ldloc, v.Index);
|
||||
il.Emit(OpCodes.Call, free_hglobal);
|
||||
|
||||
block.HandlerEnd = body.Instructions.Last();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitStringParameter(MethodDefinition wrapper, TypeReference p, MethodBody body, ILProcessor il)
|
||||
{
|
||||
// string marshaling:
|
||||
// IntPtr ptr = Marshal.StringToHGlobalAnsi(str);
|
||||
// try { calli }
|
||||
// finally { Marshal.FreeHGlobal(ptr); }
|
||||
var marshal_str_to_ptr = wrapper.Module.Import(TypeMarshal.Methods.First(m => m.Name == "StringToHGlobalAnsi"));
|
||||
|
||||
// IntPtr ptr;
|
||||
var variable_name = p.Name + "_string_ptr";
|
||||
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr));
|
||||
int index = body.Variables.Count - 1;
|
||||
|
||||
// ptr = Marshal.StringToHGlobalAnsi(str);
|
||||
il.Emit(OpCodes.Call, marshal_str_to_ptr);
|
||||
il.Emit(OpCodes.Stloc, index);
|
||||
il.Emit(OpCodes.Ldloc, index);
|
||||
|
||||
// The finally block will be emitted in the function epilogue
|
||||
}
|
||||
|
||||
static void EmitStringEpilogue(MethodDefinition wrapper, MethodBody body, ILProcessor il)
|
||||
{
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var p = wrapper.Parameters[i].ParameterType;
|
||||
if (p.Name == "String" && !p.IsArray)
|
||||
{
|
||||
var free = wrapper.Module.Import(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal"));
|
||||
|
||||
// Marshal.FreeHGlobal(ptr)
|
||||
var variable_name = p.Name + "_string_ptr";
|
||||
var v = body.Variables.First(m => m.Name == variable_name);
|
||||
il.Emit(OpCodes.Ldloc, v.Index);
|
||||
il.Emit(OpCodes.Call, free);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void EmitStringArrayParameter(MethodDefinition wrapper, TypeReference p, MethodBody body, ILProcessor il)
|
||||
{
|
||||
// string[] masrhaling:
|
||||
// IntPtr ptr = MarshalStringArrayToPtr(strings);
|
||||
// try { calli }
|
||||
// finally { UnmarshalStringArray(ptr); }
|
||||
var marshal_str_array_to_ptr = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr"));
|
||||
|
||||
// IntPtr ptr;
|
||||
var variable_name = p.Name + " _string_array_ptr";
|
||||
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr));
|
||||
int index = body.Variables.Count - 1;
|
||||
|
||||
// ptr = MarshalStringArrayToPtr(strings);
|
||||
il.Emit(OpCodes.Call, marshal_str_array_to_ptr);
|
||||
il.Emit(OpCodes.Stloc, index);
|
||||
il.Emit(OpCodes.Ldloc, index);
|
||||
|
||||
// The finally block will be emitted in the function epilogue
|
||||
}
|
||||
|
||||
static void EmitStringArrayEpilogue(MethodDefinition wrapper, MethodBody body, ILProcessor il)
|
||||
{
|
||||
for (int i = 0; i < wrapper.Parameters.Count; i++)
|
||||
{
|
||||
var p = wrapper.Parameters[i].ParameterType;
|
||||
if (p.Name == "String" && p.IsArray)
|
||||
{
|
||||
var free = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringArrayPtr"));
|
||||
var get_length = wrapper.Module.Import(TypeStringArray.Methods.First(m => m.Name == "get_Length"));
|
||||
|
||||
// FreeStringArrayPtr(string_array_ptr, string_array.Length)
|
||||
var variable_name = p.Name + "_string_array_ptr";
|
||||
var v = body.Variables.First(m => m.Name == variable_name);
|
||||
il.Emit(OpCodes.Ldloc, v.Index);
|
||||
il.Emit(OpCodes.Ldarg, i);
|
||||
il.Emit(OpCodes.Callvirt, get_length);
|
||||
il.Emit(OpCodes.Call, free);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void EmitConvenienceWrapper(MethodDefinition wrapper,
|
||||
MethodDefinition native, int difference, MethodBody body, ILProcessor il)
|
||||
{
|
||||
if (wrapper.Parameters.Count > 1)
|
||||
{
|
||||
EmitParameters(wrapper, body, il);
|
||||
}
|
||||
|
||||
if (wrapper.ReturnType.Name != "Void")
|
||||
{
|
||||
if (difference == 2)
|
||||
{
|
||||
// Convert sized out-array/reference to return value, for example:
|
||||
// void GenTextures(int n, int[] textures) -> int GenTexture()
|
||||
// {
|
||||
// const int n = 1;
|
||||
// int buffers;
|
||||
// calli GenTextures(n, &textures);
|
||||
// return result;
|
||||
// }
|
||||
body.Variables.Add(new VariableDefinition(wrapper.ReturnType));
|
||||
il.Emit(OpCodes.Ldc_I4, 1); // const int n = 1
|
||||
il.Emit(OpCodes.Ldloca, body.Variables.Count - 1); // &buffers
|
||||
}
|
||||
else if (difference == 1)
|
||||
{
|
||||
// Convert unsized out-array/reference to return value, for example:
|
||||
// void GetBoolean(GetPName pname, out bool data) -> bool GetBoolean(GetPName pname)
|
||||
// {
|
||||
// bool result;
|
||||
// GetBooleanv(pname, &result);
|
||||
// return result;
|
||||
// }
|
||||
body.Variables.Add(new VariableDefinition(wrapper.ReturnType));
|
||||
il.Emit(OpCodes.Ldloca, body.Variables.Count - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("Unknown wrapper type for ({0})", native.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (difference == 1)
|
||||
{
|
||||
// Convert in-array/reference to single element, for example:
|
||||
// void DeleteTextures(int n, ref int textures) -> void DeleteTexture(int texture)
|
||||
// {
|
||||
// const int n = 1;
|
||||
// calli DeleteTextures(n, &textures);
|
||||
// }
|
||||
il.Emit(OpCodes.Ldc_I4, 1); // const int n = 1
|
||||
il.Emit(OpCodes.Ldarga, wrapper.Parameters.Last()); // &textures
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Error.WriteLine("Unknown wrapper type for ({0})", native.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int EmitParameters(MethodDefinition method, MethodBody body, ILProcessor il)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < method.Parameters.Count; i++)
|
||||
{
|
||||
var p = method.Module.Import(method.Parameters[i].ParameterType);
|
||||
il.Emit(OpCodes.Ldarg, i);
|
||||
|
||||
if (p.Name == "StringBuilder")
|
||||
{
|
||||
// void GetShaderInfoLog(..., StringBuilder foo)
|
||||
// IntPtr foo_sb_ptr;
|
||||
// try {
|
||||
// foo_sb_ptr = Marshal.AllocHGlobal(sb.Capacity + 1);
|
||||
// glGetShaderInfoLog(..., foo_sb_ptr);
|
||||
// MarshalPtrToStringBuilder(foo_sb_ptr, sb);
|
||||
// }
|
||||
// finally {
|
||||
// Marshal.FreeHGlobal(sb_ptr);
|
||||
// }
|
||||
|
||||
// Make sure we have imported StringBuilder::Capacity and Marshal::AllocHGlobal
|
||||
var sb_get_capacity = method.Module.Import(TypeStringBuilder.Methods.First(m => m.Name == "get_Capacity"));
|
||||
var alloc_hglobal = method.Module.Import(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal"));
|
||||
|
||||
// IntPtr ptr;
|
||||
var variable_name = p.Name + " _sb_ptr";
|
||||
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr));
|
||||
int index = body.Variables.Count - 1;
|
||||
|
||||
// ptr = Marshal.AllocHGlobal(sb.Capacity + 1);
|
||||
il.Emit(OpCodes.Callvirt, sb_get_capacity);
|
||||
il.Emit(OpCodes.Call, alloc_hglobal);
|
||||
il.Emit(OpCodes.Stloc, index);
|
||||
il.Emit(OpCodes.Ldloc, index);
|
||||
|
||||
// We'll emit the try-finally block in the epilogue implementation,
|
||||
// because we haven't yet emitted all necessary instructions here.
|
||||
}
|
||||
else if (p.Name == "String" && !p.IsArray)
|
||||
{
|
||||
EmitStringParameter(method, p, body, il);
|
||||
}
|
||||
else if (p.IsByReference)
|
||||
{
|
||||
body.Variables.Add(new VariableDefinition(new PinnedType(p)));
|
||||
var index = body.Variables.Count - 1;
|
||||
il.Emit(OpCodes.Stloc, index);
|
||||
il.Emit(OpCodes.Ldloc, index);
|
||||
il.Emit(OpCodes.Conv_I);
|
||||
}
|
||||
else if (p.IsArray)
|
||||
{
|
||||
if (p.Name != method.Module.Import(typeof(string[])).Name)
|
||||
{
|
||||
// Pin the array and pass the address
|
||||
// of its first element.
|
||||
var element_type = p.GetElementType();
|
||||
body.Variables.Add(new VariableDefinition(new PinnedType(new ByReferenceType(element_type))));
|
||||
int pinned_index = body.Variables.Count - 1;
|
||||
|
||||
var empty = il.Create(OpCodes.Ldc_I4, 0);
|
||||
var pin = il.Create(OpCodes.Ldarg, i);
|
||||
var end = il.Create(OpCodes.Stloc, pinned_index);
|
||||
|
||||
// if (array == null) goto empty
|
||||
il.Emit(OpCodes.Brfalse, empty);
|
||||
|
||||
// else if (array.Length != 0) goto pin
|
||||
il.Emit(OpCodes.Ldarg, i);
|
||||
il.Emit(OpCodes.Ldlen);
|
||||
il.Emit(OpCodes.Conv_I4);
|
||||
il.Emit(OpCodes.Brtrue, pin);
|
||||
|
||||
// empty: IntPtr ptr = IntPtr.Zero
|
||||
il.Append(empty);
|
||||
il.Emit(OpCodes.Conv_U);
|
||||
il.Emit(OpCodes.Br, end);
|
||||
|
||||
// pin: &array[0]
|
||||
il.Append(pin);
|
||||
il.Emit(OpCodes.Ldc_I4, 0);
|
||||
il.Emit(OpCodes.Ldelema, element_type);
|
||||
|
||||
// end: fixed (IntPtr ptr = &array[0])
|
||||
il.Append(end);
|
||||
il.Emit(OpCodes.Ldloc, pinned_index);
|
||||
il.Emit(OpCodes.Conv_I);
|
||||
}
|
||||
else
|
||||
{
|
||||
EmitStringArrayParameter(method, p, body, il);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot)
|
||||
{
|
||||
il.Emit(OpCodes.Ldsfld, entry_points);
|
||||
il.Emit(OpCodes.Ldc_I4, slot);
|
||||
il.Emit(OpCodes.Ldelem_I);
|
||||
}
|
||||
|
||||
static void EmitCall(ILProcessor il, MethodReference reference)
|
||||
{
|
||||
var signature = new CallSite(reference.ReturnType)
|
||||
{
|
||||
CallingConvention = MethodCallingConvention.StdCall,
|
||||
};
|
||||
|
||||
foreach (var p in reference.Parameters)
|
||||
{
|
||||
signature.Parameters.Add(p);
|
||||
}
|
||||
|
||||
// Since the last parameter is always the entry point address,
|
||||
// we do not need any special preparation before emiting calli.
|
||||
il.Emit(OpCodes.Calli, signature);
|
||||
}
|
||||
}
|
||||
}
|
36
Source/Generator.Rewrite/Properties/AssemblyInfo.cs
Normal file
36
Source/Generator.Rewrite/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenTK.Rewrite")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenTK.Rewrite")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("01f167a5-6aff-41be-a70a-828c124c5164")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -34,6 +34,7 @@ namespace OpenTK
|
|||
/// <summary>
|
||||
/// Indicates that this function is generated automatically by a tool.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class AutoGeneratedAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -119,13 +119,84 @@ namespace OpenTK
|
|||
/// unique objects, but all instances of ES10.GL should return the same object.</remarks>
|
||||
protected abstract object SyncRoot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Marshals a pointer to a null-terminated byte array to the specified <c>StringBuilder</c>.
|
||||
/// This method supports OpenTK and is not intended to be called by user code.
|
||||
/// </summary>
|
||||
/// <param name="ptr">A pointer to a null-terminated byte array.</param>
|
||||
/// <param name="sb">The StringBuilder to receive the contents of the pointer.</param>
|
||||
protected static void MarshalPtrToStringBuilder(IntPtr ptr, StringBuilder sb)
|
||||
{
|
||||
if (ptr == IntPtr.Zero)
|
||||
throw new ArgumentException("ptr");
|
||||
if (sb == null)
|
||||
throw new ArgumentNullException("sb");
|
||||
|
||||
sb.Length = 0;
|
||||
for (int i = 0; i < sb.Capacity; i++)
|
||||
{
|
||||
byte b = Marshal.ReadByte(ptr, i);
|
||||
if (b == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sb.Append((char)b);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marshals a string array to unmanaged memory by calling
|
||||
/// Marshal.AllocHGlobal for each element.
|
||||
/// </summary>
|
||||
/// <returns>An unmanaged pointer to an array of null-terminated strings</returns>
|
||||
/// <param name="str_array">The string array to marshal.</param>
|
||||
protected static IntPtr MarshalStringArrayToPtr(string[] str_array)
|
||||
{
|
||||
IntPtr ptr = IntPtr.Zero;
|
||||
if (str_array != null && str_array.Length != 0)
|
||||
{
|
||||
ptr = Marshal.AllocHGlobal(str_array.Length * IntPtr.Size);
|
||||
if (ptr == IntPtr.Zero)
|
||||
{
|
||||
throw new OutOfMemoryException();
|
||||
}
|
||||
|
||||
for (int i = 0; i < str_array.Length; i++)
|
||||
{
|
||||
IntPtr str = Marshal.StringToHGlobalAnsi(str_array[i]);
|
||||
if (str == IntPtr.Zero)
|
||||
{
|
||||
throw new OutOfMemoryException();
|
||||
}
|
||||
|
||||
Marshal.WriteIntPtr(ptr, i * IntPtr.Size, str);
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Frees a string array that has previously been
|
||||
/// marshalled by <c>MarshalStringArrayToPtr</c>.
|
||||
/// </summary>
|
||||
/// <param name="ptr">An unmanaged pointer allocated by <c>MarshalStringArrayToPtr</c></param>
|
||||
/// <param name="length">The length of the string array.</param>
|
||||
protected static void FreeStringArrayPtr(IntPtr ptr, int length)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
Marshal.FreeHGlobal(Marshal.ReadIntPtr(ptr, length * IntPtr.Size));
|
||||
}
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Members
|
||||
|
||||
#region LoadEntryPoints
|
||||
|
||||
internal void LoadEntryPoints()
|
||||
internal virtual void LoadEntryPoints()
|
||||
{
|
||||
// Using reflection is more than 3 times faster than directly loading delegates on the first
|
||||
// run, probably due to code generation overhead. Subsequent runs are faster with direct loading
|
||||
|
@ -166,7 +237,7 @@ namespace OpenTK
|
|||
|
||||
#region LoadEntryPoint
|
||||
|
||||
internal bool LoadEntryPoint(string function)
|
||||
internal virtual bool LoadEntryPoint(string function)
|
||||
{
|
||||
FieldInfo f = DelegatesClass.GetField(function, BindingFlags.Static | BindingFlags.NonPublic);
|
||||
if (f == null)
|
||||
|
@ -186,6 +257,27 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region GetExtensionDelegate
|
||||
|
||||
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
|
||||
internal virtual Delegate GetExtensionDelegate(string name, Type signature)
|
||||
{
|
||||
IntPtr address = GetAddress(name);
|
||||
|
||||
if (address == IntPtr.Zero ||
|
||||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
|
||||
address == new IntPtr(2)) // 1 or 2 instead of IntPtr.Zero for some extensions.
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer(address, signature);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Members
|
||||
|
@ -204,27 +296,6 @@ namespace OpenTK
|
|||
|
||||
#endregion
|
||||
|
||||
#region GetExtensionDelegate
|
||||
|
||||
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
|
||||
internal Delegate GetExtensionDelegate(string name, Type signature)
|
||||
{
|
||||
IntPtr address = GetAddress(name);
|
||||
|
||||
if (address == IntPtr.Zero ||
|
||||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
|
||||
address == new IntPtr(2)) // 1 or 2 instead of IntPtr.Zero for some extensions.
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer(address, signature);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,361 +0,0 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2009 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
|
||||
|
||||
namespace OpenTK.Graphics.ES10
|
||||
{
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma warning disable 0649
|
||||
#pragma warning disable 3019
|
||||
#pragma warning disable 1591
|
||||
|
||||
partial class GL
|
||||
{
|
||||
internal static partial class Delegates
|
||||
{
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ActiveTexture(OpenTK.Graphics.ES10.All texture);
|
||||
internal static ActiveTexture glActiveTexture;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void AlphaFunc(OpenTK.Graphics.ES10.All func, Single @ref);
|
||||
internal static AlphaFunc glAlphaFunc;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void AlphaFuncx(OpenTK.Graphics.ES10.All func, int @ref);
|
||||
internal static AlphaFuncx glAlphaFuncx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void BindTexture(OpenTK.Graphics.ES10.All target, UInt32 texture);
|
||||
internal static BindTexture glBindTexture;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void BlendFunc(OpenTK.Graphics.ES10.All sfactor, OpenTK.Graphics.ES10.All dfactor);
|
||||
internal static BlendFunc glBlendFunc;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Clear(UInt32 mask);
|
||||
internal static Clear glClear;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClearColor(Single red, Single green, Single blue, Single alpha);
|
||||
internal static ClearColor glClearColor;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClearColorx(int red, int green, int blue, int alpha);
|
||||
internal static ClearColorx glClearColorx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClearDepthf(Single depth);
|
||||
internal static ClearDepthf glClearDepthf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClearDepthx(int depth);
|
||||
internal static ClearDepthx glClearDepthx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClearStencil(Int32 s);
|
||||
internal static ClearStencil glClearStencil;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ClientActiveTexture(OpenTK.Graphics.ES10.All texture);
|
||||
internal static ClientActiveTexture glClientActiveTexture;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Color4f(Single red, Single green, Single blue, Single alpha);
|
||||
internal static Color4f glColor4f;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Color4x(int red, int green, int blue, int alpha);
|
||||
internal static Color4x glColor4x;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ColorMask(bool red, bool green, bool blue, bool alpha);
|
||||
internal static ColorMask glColorMask;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ColorPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
|
||||
internal static ColorPointer glColorPointer;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void CompressedTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data);
|
||||
internal static CompressedTexImage2D glCompressedTexImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void CompressedTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, Int32 imageSize, IntPtr data);
|
||||
internal static CompressedTexSubImage2D glCompressedTexSubImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void CopyTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border);
|
||||
internal static CopyTexImage2D glCopyTexImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void CopyTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height);
|
||||
internal static CopyTexSubImage2D glCopyTexSubImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void CullFace(OpenTK.Graphics.ES10.All mode);
|
||||
internal static CullFace glCullFace;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void DeleteTextures(Int32 n, UInt32* textures);
|
||||
internal unsafe static DeleteTextures glDeleteTextures;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DepthFunc(OpenTK.Graphics.ES10.All func);
|
||||
internal static DepthFunc glDepthFunc;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DepthMask(bool flag);
|
||||
internal static DepthMask glDepthMask;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DepthRangef(Single zNear, Single zFar);
|
||||
internal static DepthRangef glDepthRangef;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DepthRangex(int zNear, int zFar);
|
||||
internal static DepthRangex glDepthRangex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Disable(OpenTK.Graphics.ES10.All cap);
|
||||
internal static Disable glDisable;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DisableClientState(OpenTK.Graphics.ES10.All array);
|
||||
internal static DisableClientState glDisableClientState;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DrawArrays(OpenTK.Graphics.ES10.All mode, Int32 first, Int32 count);
|
||||
internal static DrawArrays glDrawArrays;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DrawElements(OpenTK.Graphics.ES10.All mode, Int32 count, OpenTK.Graphics.ES10.All type, IntPtr indices);
|
||||
internal static DrawElements glDrawElements;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Enable(OpenTK.Graphics.ES10.All cap);
|
||||
internal static Enable glEnable;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void EnableClientState(OpenTK.Graphics.ES10.All array);
|
||||
internal static EnableClientState glEnableClientState;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Finish();
|
||||
internal static Finish glFinish;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Flush();
|
||||
internal static Flush glFlush;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Fogf(OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static Fogf glFogf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Fogfv(OpenTK.Graphics.ES10.All pname, Single* @params);
|
||||
internal unsafe static Fogfv glFogfv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Fogx(OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static Fogx glFogx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Fogxv(OpenTK.Graphics.ES10.All pname, int* @params);
|
||||
internal unsafe static Fogxv glFogxv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void FrontFace(OpenTK.Graphics.ES10.All mode);
|
||||
internal static FrontFace glFrontFace;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Frustumf(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
|
||||
internal static Frustumf glFrustumf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Frustumx(int left, int right, int bottom, int top, int zNear, int zFar);
|
||||
internal static Frustumx glFrustumx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void GenTextures(Int32 n, UInt32* textures);
|
||||
internal unsafe static GenTextures glGenTextures;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate OpenTK.Graphics.ES10.All GetError();
|
||||
internal static GetError glGetError;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void GetIntegerv(OpenTK.Graphics.ES10.All pname, Int32* @params);
|
||||
internal unsafe static GetIntegerv glGetIntegerv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate System.IntPtr GetString(OpenTK.Graphics.ES10.All name);
|
||||
internal unsafe static GetString glGetString;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Hint(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All mode);
|
||||
internal static Hint glHint;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Lightf(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static Lightf glLightf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Lightfv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single* @params);
|
||||
internal unsafe static Lightfv glLightfv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LightModelf(OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static LightModelf glLightModelf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void LightModelfv(OpenTK.Graphics.ES10.All pname, Single* @params);
|
||||
internal unsafe static LightModelfv glLightModelfv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LightModelx(OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static LightModelx glLightModelx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void LightModelxv(OpenTK.Graphics.ES10.All pname, int* @params);
|
||||
internal unsafe static LightModelxv glLightModelxv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Lightx(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static Lightx glLightx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Lightxv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int* @params);
|
||||
internal unsafe static Lightxv glLightxv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LineWidth(Single width);
|
||||
internal static LineWidth glLineWidth;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LineWidthx(int width);
|
||||
internal static LineWidthx glLineWidthx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LoadIdentity();
|
||||
internal static LoadIdentity glLoadIdentity;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void LoadMatrixf(Single* m);
|
||||
internal unsafe static LoadMatrixf glLoadMatrixf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void LoadMatrixx(int* m);
|
||||
internal unsafe static LoadMatrixx glLoadMatrixx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void LogicOp(OpenTK.Graphics.ES10.All opcode);
|
||||
internal static LogicOp glLogicOp;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Materialf(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static Materialf glMaterialf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Materialfv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single* @params);
|
||||
internal unsafe static Materialfv glMaterialfv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Materialx(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static Materialx glMaterialx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void Materialxv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int* @params);
|
||||
internal unsafe static Materialxv glMaterialxv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void MatrixMode(OpenTK.Graphics.ES10.All mode);
|
||||
internal static MatrixMode glMatrixMode;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void MultiTexCoord4f(OpenTK.Graphics.ES10.All target, Single s, Single t, Single r, Single q);
|
||||
internal static MultiTexCoord4f glMultiTexCoord4f;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void MultiTexCoord4x(OpenTK.Graphics.ES10.All target, int s, int t, int r, int q);
|
||||
internal static MultiTexCoord4x glMultiTexCoord4x;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void MultMatrixf(Single* m);
|
||||
internal unsafe static MultMatrixf glMultMatrixf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void MultMatrixx(int* m);
|
||||
internal unsafe static MultMatrixx glMultMatrixx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Normal3f(Single nx, Single ny, Single nz);
|
||||
internal static Normal3f glNormal3f;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Normal3x(int nx, int ny, int nz);
|
||||
internal static Normal3x glNormal3x;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void NormalPointer(OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
|
||||
internal static NormalPointer glNormalPointer;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Orthof(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
|
||||
internal static Orthof glOrthof;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Orthox(int left, int right, int bottom, int top, int zNear, int zFar);
|
||||
internal static Orthox glOrthox;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PixelStorei(OpenTK.Graphics.ES10.All pname, Int32 param);
|
||||
internal static PixelStorei glPixelStorei;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PointSize(Single size);
|
||||
internal static PointSize glPointSize;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PointSizex(int size);
|
||||
internal static PointSizex glPointSizex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PolygonOffset(Single factor, Single units);
|
||||
internal static PolygonOffset glPolygonOffset;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PolygonOffsetx(int factor, int units);
|
||||
internal static PolygonOffsetx glPolygonOffsetx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PopMatrix();
|
||||
internal static PopMatrix glPopMatrix;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void PushMatrix();
|
||||
internal static PushMatrix glPushMatrix;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ReadPixels(Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
|
||||
internal static ReadPixels glReadPixels;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Rotatef(Single angle, Single x, Single y, Single z);
|
||||
internal static Rotatef glRotatef;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Rotatex(int angle, int x, int y, int z);
|
||||
internal static Rotatex glRotatex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void SampleCoverage(Single value, bool invert);
|
||||
internal static SampleCoverage glSampleCoverage;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void SampleCoveragex(int value, bool invert);
|
||||
internal static SampleCoveragex glSampleCoveragex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Scalef(Single x, Single y, Single z);
|
||||
internal static Scalef glScalef;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Scalex(int x, int y, int z);
|
||||
internal static Scalex glScalex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Scissor(Int32 x, Int32 y, Int32 width, Int32 height);
|
||||
internal static Scissor glScissor;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void ShadeModel(OpenTK.Graphics.ES10.All mode);
|
||||
internal static ShadeModel glShadeModel;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void StencilFunc(OpenTK.Graphics.ES10.All func, Int32 @ref, UInt32 mask);
|
||||
internal static StencilFunc glStencilFunc;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void StencilMask(UInt32 mask);
|
||||
internal static StencilMask glStencilMask;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void StencilOp(OpenTK.Graphics.ES10.All fail, OpenTK.Graphics.ES10.All zfail, OpenTK.Graphics.ES10.All zpass);
|
||||
internal static StencilOp glStencilOp;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexCoordPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
|
||||
internal static TexCoordPointer glTexCoordPointer;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexEnvf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static TexEnvf glTexEnvf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void TexEnvfv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single* @params);
|
||||
internal unsafe static TexEnvfv glTexEnvfv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexEnvx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static TexEnvx glTexEnvx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate void TexEnvxv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int* @params);
|
||||
internal unsafe static TexEnvxv glTexEnvxv;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
|
||||
internal static TexImage2D glTexImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexParameterf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
|
||||
internal static TexParameterf glTexParameterf;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexParameterx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
|
||||
internal static TexParameterx glTexParameterx;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void TexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
|
||||
internal static TexSubImage2D glTexSubImage2D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Translatef(Single x, Single y, Single z);
|
||||
internal static Translatef glTranslatef;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Translatex(int x, int y, int z);
|
||||
internal static Translatex glTranslatex;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void VertexPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
|
||||
internal static VertexPointer glVertexPointer;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void Viewport(Int32 x, Int32 y, Int32 width, Int32 height);
|
||||
internal static Viewport glViewport;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -24,5 +24,14 @@ namespace OpenTK.Graphics.ES10
|
|||
|
||||
#endregion
|
||||
|
||||
internal override void LoadEntryPoints()
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
internal override bool LoadEntryPoint(string function)
|
||||
{
|
||||
return true; // nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -15,6 +15,22 @@ namespace OpenTK.Graphics.ES11
|
|||
const string Library = "GLESv1_CM";
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
static string[] EntryPointNames;
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public GL()
|
||||
{
|
||||
EntryPointsInstance = EntryPoints;
|
||||
EntryPointNamesInstance = EntryPointNames;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
/// <summary>
|
||||
|
|
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
|
@ -42,6 +42,22 @@ namespace OpenTK.Graphics.ES20
|
|||
const string Library = "libGLESv2.dll";
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
static string[] EntryPointNames;
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public GL()
|
||||
{
|
||||
EntryPointsInstance = EntryPoints;
|
||||
EntryPointNamesInstance = EntryPointNames;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
/// <summary>
|
||||
|
|
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
|
@ -42,6 +42,22 @@ namespace OpenTK.Graphics.ES30
|
|||
const string Library = "libGLESv2.dll";
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
static string[] EntryPointNames;
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public GL()
|
||||
{
|
||||
EntryPointsInstance = EntryPoints;
|
||||
EntryPointNamesInstance = EntryPointNames;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Graphics
|
||||
{
|
||||
|
@ -34,6 +35,18 @@ namespace OpenTK.Graphics
|
|||
/// </summary>
|
||||
public abstract class GraphicsBindingsBase : BindingsBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the list of API entry points (function pointers).
|
||||
/// This field must be set by an inheriting class.
|
||||
/// </summary>
|
||||
protected IntPtr[] EntryPointsInstance;
|
||||
|
||||
/// <summary>
|
||||
/// Contains the list of API entry point names.
|
||||
/// This field must be set by an inheriting class.
|
||||
/// </summary>
|
||||
protected string[] EntryPointNamesInstance;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an unmanaged function pointer to the specified function.
|
||||
/// </summary>
|
||||
|
@ -56,5 +69,22 @@ namespace OpenTK.Graphics
|
|||
throw new GraphicsContextMissingException();
|
||||
return context != null ? context.GetAddress(funcname) : IntPtr.Zero;
|
||||
}
|
||||
|
||||
// Loads all available entry points for the current API.
|
||||
// Note: we prefer IGraphicsContextInternal.GetAddress over
|
||||
// this.GetAddress to improve loading performance (less
|
||||
// validation necessary.)
|
||||
internal override void LoadEntryPoints()
|
||||
{
|
||||
IGraphicsContext context = GraphicsContext.CurrentContext;
|
||||
if (context == null)
|
||||
throw new GraphicsContextMissingException();
|
||||
|
||||
IGraphicsContextInternal context_internal = context as IGraphicsContextInternal;
|
||||
for (int i = 0; i < EntryPointsInstance.Length; i++)
|
||||
{
|
||||
EntryPointsInstance[i] = context_internal.GetAddress(EntryPointNamesInstance[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,18 +544,36 @@ namespace OpenTK.Graphics
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address of an OpenGL extension function.
|
||||
/// Retrieves the implementation-defined address of an OpenGL function.
|
||||
/// </summary>
|
||||
/// <param name="function">The name of the OpenGL function (e.g. "glGetString")</param>
|
||||
/// <returns>
|
||||
/// A pointer to the specified function or IntPtr.Zero if the function isn't
|
||||
/// available in the current opengl context.
|
||||
/// A pointer to the specified function or an invalid pointer if the function is not
|
||||
/// available in the current OpenGL context. The return value and calling convention
|
||||
/// depends on the underlying platform.
|
||||
/// </returns>
|
||||
IntPtr IGraphicsContextInternal.GetAddress(string function)
|
||||
{
|
||||
return (implementation as IGraphicsContextInternal).GetAddress(function);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the implementation-defined address of an OpenGL function.
|
||||
/// </summary>
|
||||
/// <param name="function">
|
||||
/// A pointer to a null-terminated buffer
|
||||
/// containing the name of the OpenGL function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A pointer to the specified function or an invalid pointer if the function is not
|
||||
/// available in the current OpenGL context. The return value and calling convention
|
||||
/// depends on the underlying platform.
|
||||
/// </returns>
|
||||
IntPtr IGraphicsContextInternal.GetAddress(IntPtr function)
|
||||
{
|
||||
return (implementation as IGraphicsContextInternal).GetAddress(function);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IDisposable Members ---
|
||||
|
|
|
@ -94,6 +94,8 @@ namespace OpenTK.Graphics
|
|||
|
||||
public abstract IntPtr GetAddress(string function);
|
||||
|
||||
public abstract IntPtr GetAddress(IntPtr function);
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
|
|
@ -112,13 +112,29 @@ namespace OpenTK.Graphics
|
|||
ContextHandle Context { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the address of an OpenGL extension function.
|
||||
/// Retrieves the implementation-defined address of an OpenGL function.
|
||||
/// </summary>
|
||||
/// <param name="function">The name of the OpenGL function (e.g. "glGetString")</param>
|
||||
/// <returns>
|
||||
/// A pointer to the specified function or IntPtr.Zero if the function isn't
|
||||
/// available in the current opengl context.
|
||||
/// A pointer to the specified function or an invalid pointer if the function is not
|
||||
/// available in the current OpenGL context. The return value and calling convention
|
||||
/// depends on the underlying platform.
|
||||
/// </returns>
|
||||
IntPtr GetAddress(string function);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the implementation-defined address of an OpenGL function.
|
||||
/// </summary>
|
||||
/// <param name="function">
|
||||
/// A pointer to a null-terminated buffer
|
||||
/// containing the name of the OpenGL function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A pointer to the specified function or an invalid pointer if the function is not
|
||||
/// available in the current OpenGL context. The return value and calling convention
|
||||
/// depends on the underlying platform.
|
||||
/// </returns>
|
||||
/// <remarks><seealso cref="GetAddress(string)"/></remarks>
|
||||
IntPtr GetAddress(IntPtr function);
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -1,11 +1,31 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2006-2008 the OpenTK team.
|
||||
* See license.txt for license info
|
||||
*
|
||||
* Contributions by Andy Gill.
|
||||
*/
|
||||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 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
|
||||
// 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
|
||||
|
||||
|
||||
#region --- Using Directives ---
|
||||
|
||||
using System;
|
||||
|
@ -58,12 +78,20 @@ namespace OpenTK.Graphics.OpenGL
|
|||
static SortedList<string, bool> AvailableExtensions = new SortedList<string, bool>();
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
static string[] EntryPointNames;
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Constructor ---
|
||||
#region Constructors
|
||||
|
||||
static GL()
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public GL()
|
||||
{
|
||||
EntryPointsInstance = EntryPoints;
|
||||
EntryPointNamesInstance = EntryPointNames;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1106,28 +1134,24 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
#region Obsolete
|
||||
|
||||
[AutoGenerated(Category = "Version11Deprecated", Version = "1.1", EntryPoint = "glDisableClientState")]
|
||||
[Obsolete("Use DisableClientState(ArrayCap) instead")]
|
||||
public static void DisableClientState(OpenTK.Graphics.OpenGL.EnableCap array)
|
||||
{
|
||||
DisableClientState((ArrayCap)array);
|
||||
}
|
||||
|
||||
[AutoGenerated(Category = "Version11Deprecated", Version = "1.1", EntryPoint = "glEnableClientState")]
|
||||
[Obsolete("Use EnableClientState(ArrayCap) instead.")]
|
||||
public static void EnableClientState(OpenTK.Graphics.OpenGL.EnableCap array)
|
||||
{
|
||||
EnableClientState((ArrayCap)array);
|
||||
}
|
||||
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static void GetActiveUniforms(Int32 program, Int32 uniformCount, Int32[] uniformIndices, ArbUniformBufferObject pname, [OutAttribute] Int32[] @params)
|
||||
{
|
||||
GetActiveUniforms(program, uniformCount, uniformIndices, (ActiveUniformParameter)pname, @params);
|
||||
}
|
||||
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static void GetActiveUniforms(Int32 program, Int32 uniformCount, ref Int32 uniformIndices, ArbUniformBufferObject pname, [OutAttribute] out Int32 @params)
|
||||
{
|
||||
|
@ -1135,7 +1159,6 @@ namespace OpenTK.Graphics.OpenGL
|
|||
}
|
||||
|
||||
[System.CLSCompliant(false)]
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static unsafe void GetActiveUniforms(Int32 program, Int32 uniformCount, Int32* uniformIndices, ArbUniformBufferObject pname, [OutAttribute] Int32* @params)
|
||||
{
|
||||
|
@ -1143,7 +1166,6 @@ namespace OpenTK.Graphics.OpenGL
|
|||
}
|
||||
|
||||
[System.CLSCompliant(false)]
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static void GetActiveUniforms(UInt32 program, Int32 uniformCount, UInt32[] uniformIndices, ArbUniformBufferObject pname, [OutAttribute] Int32[] @params)
|
||||
{
|
||||
|
@ -1151,7 +1173,6 @@ namespace OpenTK.Graphics.OpenGL
|
|||
}
|
||||
|
||||
[System.CLSCompliant(false)]
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static void GetActiveUniforms(UInt32 program, Int32 uniformCount, ref UInt32 uniformIndices, ArbUniformBufferObject pname, [OutAttribute] out Int32 @params)
|
||||
{
|
||||
|
@ -1159,7 +1180,6 @@ namespace OpenTK.Graphics.OpenGL
|
|||
}
|
||||
|
||||
[System.CLSCompliant(false)]
|
||||
[AutoGenerated(Category = "ArbUniformBufferObject", Version = "2.0", EntryPoint = "glGetActiveUniformsiv")]
|
||||
[Obsolete("Use GetActiveUniforms(..., ActiveUniformParameter, ...) instead.")]
|
||||
public static unsafe void GetActiveUniforms(UInt32 program, Int32 uniformCount, UInt32* uniformIndices, ArbUniformBufferObject pname, [OutAttribute] Int32* @params)
|
||||
{
|
||||
|
@ -1205,14 +1225,12 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
public static partial class Arb
|
||||
{
|
||||
[AutoGenerated(Category = "ArbGeometryShader4", Version = "3.0", EntryPoint = "glProgramParameteriARB")]
|
||||
[Obsolete("Use ProgramParameter(..., AssemblyProgramParameterArb, ...) instead.")]
|
||||
public static void ProgramParameter(Int32 program, ArbGeometryShader4 pname, Int32 value)
|
||||
{
|
||||
ProgramParameter(program, (AssemblyProgramParameterArb)pname, value);
|
||||
}
|
||||
|
||||
[AutoGenerated(Category = "ArbGeometryShader4", Version = "3.0", EntryPoint = "glProgramParameteriARB")]
|
||||
[Obsolete("Use ProgramParameter(..., AssemblyProgramParameterArb, ...) instead.")]
|
||||
[CLSCompliant(false)]
|
||||
public static void ProgramParameter(UInt32 program, ArbGeometryShader4 pname, Int32 value)
|
||||
|
@ -1223,14 +1241,12 @@ namespace OpenTK.Graphics.OpenGL
|
|||
|
||||
public static partial class Ext
|
||||
{
|
||||
[AutoGenerated(Category = "EXT_geometry_shader4", Version = "2.0", EntryPoint = "glProgramParameteriEXT")]
|
||||
[Obsolete("Use ProgramParameter(..., AssemblyProgramParameterArb, ...) instead.")]
|
||||
public static void ProgramParameter(Int32 program, ExtGeometryShader4 pname, Int32 value)
|
||||
{
|
||||
ProgramParameter(program, (AssemblyProgramParameterArb)pname, value);
|
||||
}
|
||||
|
||||
[AutoGenerated(Category = "ArbGeometryShader4", Version = "3.0", EntryPoint = "glProgramParameteriARB")]
|
||||
[Obsolete("Use ProgramParameter(..., AssemblyProgramParameterArb, ...) instead.")]
|
||||
[CLSCompliant(false)]
|
||||
public static void ProgramParameter(UInt32 program, ExtGeometryShader4 pname, Int32 value)
|
||||
|
|
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
|
@ -42,6 +42,22 @@ namespace OpenTK.Graphics.OpenGL4
|
|||
const string Library = "opengl32.dll";
|
||||
static readonly object sync_root = new object();
|
||||
|
||||
static IntPtr[] EntryPoints;
|
||||
static string[] EntryPointNames;
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
public GL()
|
||||
{
|
||||
EntryPointsInstance = EntryPoints;
|
||||
EntryPointNamesInstance = EntryPointNames;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
/// <summary>
|
||||
|
|
186
Source/OpenTK/InteropHelper.cs
Normal file
186
Source/OpenTK/InteropHelper.cs
Normal file
|
@ -0,0 +1,186 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 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
|
||||
// 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;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
class InteropHelper
|
||||
{
|
||||
public static void Call(IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0>(T0 arg0, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1>(T0 arg0, T1 arg1, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2>(T0 arg0, T1 arg1, T2 arg2, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static void Call<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet>(IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0>(T0 arg0, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1>(T0 arg0, T1 arg1, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2>(T0 arg0, T1 arg1, T2 arg2, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2, T3>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2, T3, T4>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2, T3, T4, T5>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2, T3, T4, T5, T6>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static TRet CallReturn<TRet, T0, T1, T2, T3, T4, T5, T6, T7>(T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, IntPtr address)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static IntPtr Pin<T>(T[] arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static IntPtr Pin<T>(T[,] arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static IntPtr Pin<T>(T[,,] arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static IntPtr Pin<T>(ref T arg)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -83,6 +83,8 @@
|
|||
<Optimize>True</Optimize>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
|
@ -134,6 +136,7 @@
|
|||
<Compile Include="Input\IInputDriver2.cs" />
|
||||
<Compile Include="Input\IKeyboardDriver2.cs" />
|
||||
<Compile Include="Input\IMouseDriver2.cs" />
|
||||
<Compile Include="InteropHelper.cs" />
|
||||
<Compile Include="Math\Matrix2.cs" />
|
||||
<Compile Include="Math\Matrix2d.cs" />
|
||||
<Compile Include="Math\Matrix2x3.cs" />
|
||||
|
@ -359,9 +362,6 @@
|
|||
<Compile Include="Platform\Windows\Bindings\WglDelegates.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Platform\Windows\Bindings\WglCore.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Platform\Windows\Bindings\WglEnums.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -452,18 +452,12 @@
|
|||
<Compile Include="Graphics\ColorFormat.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL\GLDelegates.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL\GLHelper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL\GLEnums.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL\GLCore.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL\GL.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -482,9 +476,6 @@
|
|||
<Compile Include="Graphics\ES10\Helper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\ES10\Delegates.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\ES10\Core.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -734,16 +725,6 @@
|
|||
<Compile Include="Audio\OpenAL\AL\ALEnums.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="..\..\OpenTK.snk">
|
||||
<Link>OpenTK.snk</Link>
|
||||
</None>
|
||||
|
@ -785,21 +766,15 @@
|
|||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Graphics\OpenGL4\GL4.cs" />
|
||||
<Compile Include="Graphics\OpenGL4\GL4Core.cs" />
|
||||
<Compile Include="Graphics\OpenGL4\GL4Delegates.cs" />
|
||||
<Compile Include="Graphics\OpenGL4\GL4Enums.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30Core.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30Delegates.cs" />
|
||||
<Compile Include="Graphics\ES30\ES30Enums.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20Core.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20Delegates.cs" />
|
||||
<Compile Include="Graphics\ES20\ES20Enums.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11Core.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11Delegates.cs" />
|
||||
<Compile Include="Graphics\ES11\ES11Enums.cs" />
|
||||
<Compile Include="SlotAttribute.cs" />
|
||||
<Compile Include="RewrittenAttribute.cs" />
|
||||
<Compile Include="Graphics\OpenGL\GLObsolete.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -810,5 +785,22 @@
|
|||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup />
|
||||
<Target Name="AfterBuild">
|
||||
<Exec Command="$(OutputPath)..\..\Tools\$(Configuration)\Rewrite.exe $(OutputPath)OpenTK.dll ..\..\OpenTK.snk" Condition="$(OS) == 'Windows_NT'" />
|
||||
<Exec Command="mono $(OutputPath)..\..\Tools\$(Configuration)\Rewrite.exe $(OutputPath)OpenTK.dll ..\..\OpenTK.snk" Condition="$(OS) != 'Windows_NT'" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/plain" />
|
||||
<CSharpFormattingPolicy IndentSwitchBody="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ElseNewLinePlacement="NewLine" CatchNewLinePlacement="NewLine" FinallyNewLinePlacement="NewLine" WhileNewLinePlacement="NewLine" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" BeforeIndexerDeclarationBracket="False" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" BlankLinesBeforeFirstDeclaration="1" AlignToFirstMethodDeclarationParameter="False" AlignToFirstIndexerDeclarationParameter="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
<TextStylePolicy FileWidth="120" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<StandardHeader Text="#region License

${FileName}
 
Author:
 ${AuthorName} <${AuthorEmail}>

Copyright (c) 2006-${Year} ${CopyrightHolder}

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" IncludeInNewFiles="True" />
|
||||
<TextStylePolicy TabWidth="2" IndentWidth="2" NoTabsAfterNonTabs="True" inheritsSet="VisualStudio" inheritsScope="text/plain" scope="application/xml" />
|
||||
<XmlFormattingPolicy inheritsSet="Mono" inheritsScope="application/xml" scope="application/xml" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -26,6 +26,7 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform
|
||||
|
@ -35,12 +36,16 @@ namespace OpenTK.Platform
|
|||
{
|
||||
public override void LoadAll()
|
||||
{
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
|
||||
new OpenTK.Graphics.OpenGL.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.OpenGL4.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES10.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES11.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES20.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES30.GL().LoadEntryPoints();
|
||||
|
||||
Debug.Print("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,8 @@ namespace OpenTK.Platform.Dummy
|
|||
|
||||
public override IntPtr GetAddress(string function) { return IntPtr.Zero; }
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function) { return IntPtr.Zero; }
|
||||
|
||||
public override int SwapInterval
|
||||
{
|
||||
get
|
||||
|
|
|
@ -308,6 +308,9 @@ namespace OpenTK.Platform.Egl
|
|||
[DllImportAttribute("libEGL.dll", EntryPoint = "eglGetProcAddress")]
|
||||
public static extern IntPtr GetProcAddress(string funcname);
|
||||
|
||||
[DllImportAttribute("libEGL.dll", EntryPoint = "eglGetProcAddress")]
|
||||
public static extern IntPtr GetProcAddress(IntPtr funcname);
|
||||
|
||||
// Returns true if Egl drivers exist on the system.
|
||||
public static bool IsSupported
|
||||
{
|
||||
|
|
|
@ -143,6 +143,11 @@ namespace OpenTK.Platform.Egl
|
|||
return Egl.GetProcAddress(function);
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function)
|
||||
{
|
||||
return Egl.GetProcAddress(function);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace OpenTK.Platform
|
||||
|
@ -35,10 +36,14 @@ namespace OpenTK.Platform
|
|||
{
|
||||
public override void LoadAll()
|
||||
{
|
||||
Stopwatch time = Stopwatch.StartNew();
|
||||
|
||||
new OpenTK.Graphics.ES10.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES11.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES20.GL().LoadEntryPoints();
|
||||
new OpenTK.Graphics.ES30.GL().LoadEntryPoints();
|
||||
|
||||
Debug.Print("Bindings loaded in {0} ms.", time.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -468,21 +468,57 @@ namespace OpenTK.Platform.MacOS
|
|||
|
||||
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
|
||||
private static extern bool NSIsSymbolNameDefined(string s);
|
||||
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
|
||||
private static extern bool NSIsSymbolNameDefined(IntPtr s);
|
||||
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
|
||||
private static extern IntPtr NSLookupAndBindSymbol(string s);
|
||||
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
|
||||
private static extern IntPtr NSLookupAndBindSymbol(IntPtr s);
|
||||
[DllImport(Library, EntryPoint = "NSAddressOfSymbol")]
|
||||
private static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
|
||||
|
||||
public override IntPtr GetAddress(string function)
|
||||
{
|
||||
string fname = "_" + function;
|
||||
if (!NSIsSymbolNameDefined(fname))
|
||||
// Instead of allocating and combining strings in managed memory
|
||||
// we do that directly in unmanaged memory. This way, we avoid
|
||||
// 2 string allocations every time this function is called.
|
||||
|
||||
// must add a '_' prefix and null-terminate the function name,
|
||||
// hence we allocate +2 bytes
|
||||
IntPtr ptr = Marshal.AllocHGlobal(function.Length + 2);
|
||||
try
|
||||
{
|
||||
Marshal.WriteByte(ptr, (byte)'_');
|
||||
for (int i = 0; i < function.Length; i++)
|
||||
{
|
||||
Marshal.WriteByte(ptr, i + 1, (byte)function[i]);
|
||||
}
|
||||
Marshal.WriteByte(ptr, function.Length + 1, 0); // null-terminate
|
||||
|
||||
IntPtr symbol = IntPtr.Zero;
|
||||
if (NSIsSymbolNameDefined(ptr))
|
||||
{
|
||||
symbol = NSLookupAndBindSymbol(ptr);
|
||||
if (symbol != IntPtr.Zero)
|
||||
symbol = NSAddressOfSymbol(symbol);
|
||||
}
|
||||
return symbol;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function)
|
||||
{
|
||||
if (!NSIsSymbolNameDefined(function))
|
||||
return IntPtr.Zero;
|
||||
|
||||
IntPtr symbol = NSLookupAndBindSymbol(fname);
|
||||
|
||||
IntPtr symbol = NSLookupAndBindSymbol(function);
|
||||
if (symbol != IntPtr.Zero)
|
||||
symbol = NSAddressOfSymbol(symbol);
|
||||
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ namespace OpenTK.Platform.SDL2
|
|||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GL_GetProcAddress", ExactSpelling = true)]
|
||||
static extern IntPtr GetProcAddress(IntPtr proc);
|
||||
public static extern IntPtr GetProcAddress(IntPtr proc);
|
||||
public static IntPtr GetProcAddress(string proc)
|
||||
{
|
||||
IntPtr p = Marshal.StringToHGlobalAnsi(proc);
|
||||
|
|
|
@ -294,6 +294,11 @@ namespace OpenTK.Platform.SDL2
|
|||
return SDL.GL.GetProcAddress(function);
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function)
|
||||
{
|
||||
return SDL.GL.GetProcAddress(function);
|
||||
}
|
||||
|
||||
public override bool IsCurrent
|
||||
{
|
||||
get
|
||||
|
|
|
@ -581,15 +581,13 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#region GetProcAddress
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="handle"></param>
|
||||
/// <param name="funcname"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern IntPtr GetProcAddress(IntPtr handle, string funcname);
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
internal static extern IntPtr GetProcAddress(IntPtr handle, IntPtr funcname);
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,94 +0,0 @@
|
|||
namespace OpenTK.Platform.Windows
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#pragma warning disable 3019
|
||||
#pragma warning disable 1591
|
||||
|
||||
partial class Wgl
|
||||
{
|
||||
|
||||
internal static partial class Imports
|
||||
{
|
||||
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCreateContext", ExactSpelling = true, SetLastError=true)]
|
||||
internal extern static IntPtr CreateContext(IntPtr hDc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDeleteContext", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static Boolean DeleteContext(IntPtr oldContext);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentContext", ExactSpelling = true, SetLastError=true)]
|
||||
internal extern static IntPtr GetCurrentContext();
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglMakeCurrent", ExactSpelling = true, SetLastError=true)]
|
||||
internal extern static Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCopyContext", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglChoosePixelFormat", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static IntPtr GetCurrentDC();
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetDefaultProcAddress", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static IntPtr GetDefaultProcAddress(String lpszProc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetProcAddress", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static IntPtr GetProcAddress(String lpszProc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetPixelFormat", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static int GetPixelFormat(IntPtr hdc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static Boolean SwapBuffers(IntPtr hdc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglShareLists", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglCreateLayerContext", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static IntPtr CreateLayerContext(IntPtr hDc, int level);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribeLayerPlane", ExactSpelling = true)]
|
||||
internal extern static unsafe Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, LayerPlaneDescriptor* plpd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetLayerPaletteEntries", ExactSpelling = true)]
|
||||
internal extern static unsafe int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetLayerPaletteEntries", ExactSpelling = true)]
|
||||
internal extern static unsafe int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglRealizeLayerPalette", ExactSpelling = true)]
|
||||
internal extern static Boolean RealizeLayerPalette(IntPtr hdc, int iLayerPlane, Boolean bRealize);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapLayerBuffers", ExactSpelling = true)]
|
||||
internal extern static Boolean SwapLayerBuffers(IntPtr hdc, UInt32 fuFlags);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsA", CharSet = CharSet.Auto)]
|
||||
internal extern static Boolean UseFontBitmapsA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsW", CharSet = CharSet.Auto)]
|
||||
internal extern static Boolean UseFontBitmapsW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontOutlinesA", CharSet = CharSet.Auto)]
|
||||
internal extern static unsafe Boolean UseFontOutlinesA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, GlyphMetricsFloat* glyphMetrics);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontOutlinesW", CharSet = CharSet.Auto)]
|
||||
internal extern static unsafe Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, GlyphMetricsFloat* glyphMetrics);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglMakeContextCurrentEXT", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglChoosePixelFormatEXT", ExactSpelling = true, SetLastError = true)]
|
||||
internal extern static unsafe Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,30 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
|
||||
//
|
||||
// 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
|
||||
|
||||
namespace OpenTK.Platform.Windows
|
||||
{
|
||||
using System;
|
||||
|
@ -10,94 +37,10 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
internal static partial class Delegates
|
||||
{
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr CreateContext(IntPtr hDc);
|
||||
internal static CreateContext wglCreateContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DeleteContext(IntPtr oldContext);
|
||||
internal static DeleteContext wglDeleteContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetCurrentContext();
|
||||
internal static GetCurrentContext wglGetCurrentContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean MakeCurrent(IntPtr hDc, IntPtr newContext);
|
||||
internal static MakeCurrent wglMakeCurrent;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
|
||||
internal static CopyContext wglCopyContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate int ChoosePixelFormat(IntPtr hDc, PixelFormatDescriptor* pPfd);
|
||||
internal unsafe static ChoosePixelFormat wglChoosePixelFormat;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, PixelFormatDescriptor* ppfd);
|
||||
internal unsafe static DescribePixelFormat wglDescribePixelFormat;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetCurrentDC();
|
||||
internal static GetCurrentDC wglGetCurrentDC;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetDefaultProcAddress(String lpszProc);
|
||||
internal static GetDefaultProcAddress wglGetDefaultProcAddress;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetProcAddress(String lpszProc);
|
||||
internal static GetProcAddress wglGetProcAddress;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int GetPixelFormat(IntPtr hdc);
|
||||
internal static GetPixelFormat wglGetPixelFormat;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean SetPixelFormat(IntPtr hdc, int ipfd, PixelFormatDescriptor* ppfd);
|
||||
internal unsafe static SetPixelFormat wglSetPixelFormat;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SwapBuffers(IntPtr hdc);
|
||||
internal static SwapBuffers wglSwapBuffers;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean ShareLists(IntPtr hrcSrvShare, IntPtr hrcSrvSource);
|
||||
internal static ShareLists wglShareLists;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr CreateLayerContext(IntPtr hDc, int level);
|
||||
internal static CreateLayerContext wglCreateLayerContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, LayerPlaneDescriptor* plpd);
|
||||
internal unsafe static DescribeLayerPlane wglDescribeLayerPlane;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
internal unsafe static SetLayerPaletteEntries wglSetLayerPaletteEntries;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
internal unsafe static GetLayerPaletteEntries wglGetLayerPaletteEntries;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean RealizeLayerPalette(IntPtr hdc, int iLayerPlane, Boolean bRealize);
|
||||
internal static RealizeLayerPalette wglRealizeLayerPalette;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SwapLayerBuffers(IntPtr hdc, UInt32 fuFlags);
|
||||
internal static SwapLayerBuffers wglSwapLayerBuffers;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean UseFontBitmapsA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
internal static UseFontBitmapsA wglUseFontBitmapsA;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean UseFontBitmapsW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
internal static UseFontBitmapsW wglUseFontBitmapsW;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean UseFontOutlinesA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, GlyphMetricsFloat* glyphMetrics);
|
||||
internal unsafe static UseFontOutlinesA wglUseFontOutlinesA;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, GlyphMetricsFloat* glyphMetrics);
|
||||
internal unsafe static UseFontOutlinesW wglUseFontOutlinesW;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreateContextAttribsARB(IntPtr hDC, IntPtr hShareContext, int* attribList);
|
||||
internal unsafe static CreateContextAttribsARB wglCreateContextAttribsARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr CreateBufferRegionARB(IntPtr hDC, int iLayerPlane, UInt32 uType);
|
||||
internal static CreateBufferRegionARB wglCreateBufferRegionARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DeleteBufferRegionARB(IntPtr hRegion);
|
||||
internal static DeleteBufferRegionARB wglDeleteBufferRegionARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SaveBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height);
|
||||
internal static SaveBufferRegionARB wglSaveBufferRegionARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean RestoreBufferRegionARB(IntPtr hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
internal static RestoreBufferRegionARB wglRestoreBufferRegionARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetExtensionsStringARB(IntPtr hdc);
|
||||
internal static GetExtensionsStringARB wglGetExtensionsStringARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
|
@ -140,170 +83,14 @@ namespace OpenTK.Platform.Windows
|
|||
internal unsafe delegate Boolean SetPbufferAttribARB(IntPtr hPbuffer, int* piAttribList);
|
||||
internal unsafe static SetPbufferAttribARB wglSetPbufferAttribARB;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate bool CreateDisplayColorTableEXT(UInt16 id);
|
||||
internal static CreateDisplayColorTableEXT wglCreateDisplayColorTableEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate bool LoadDisplayColorTableEXT(UInt16* table, UInt32 length);
|
||||
internal unsafe static LoadDisplayColorTableEXT wglLoadDisplayColorTableEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate bool BindDisplayColorTableEXT(UInt16 id);
|
||||
internal static BindDisplayColorTableEXT wglBindDisplayColorTableEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void DestroyDisplayColorTableEXT(UInt16 id);
|
||||
internal static DestroyDisplayColorTableEXT wglDestroyDisplayColorTableEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetExtensionsStringEXT();
|
||||
internal static GetExtensionsStringEXT wglGetExtensionsStringEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean MakeContextCurrentEXT(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc);
|
||||
internal static MakeContextCurrentEXT wglMakeContextCurrentEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetCurrentReadDCEXT();
|
||||
internal static GetCurrentReadDCEXT wglGetCurrentReadDCEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreatePbufferEXT(IntPtr hDC, int iPixelFormat, int iWidth, int iHeight, int* piAttribList);
|
||||
internal unsafe static CreatePbufferEXT wglCreatePbufferEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetPbufferDCEXT(IntPtr hPbuffer);
|
||||
internal static GetPbufferDCEXT wglGetPbufferDCEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int ReleasePbufferDCEXT(IntPtr hPbuffer, IntPtr hDC);
|
||||
internal static ReleasePbufferDCEXT wglReleasePbufferDCEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DestroyPbufferEXT(IntPtr hPbuffer);
|
||||
internal static DestroyPbufferEXT wglDestroyPbufferEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean QueryPbufferEXT(IntPtr hPbuffer, int iAttribute, [Out] int* piValue);
|
||||
internal unsafe static QueryPbufferEXT wglQueryPbufferEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetPixelFormatAttribivEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues);
|
||||
internal unsafe static GetPixelFormatAttribivEXT wglGetPixelFormatAttribivEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetPixelFormatAttribfvEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues);
|
||||
internal unsafe static GetPixelFormatAttribfvEXT wglGetPixelFormatAttribfvEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
|
||||
internal unsafe static ChoosePixelFormatEXT wglChoosePixelFormatEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SwapIntervalEXT(int interval);
|
||||
internal static SwapIntervalEXT wglSwapIntervalEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int GetSwapIntervalEXT();
|
||||
internal static GetSwapIntervalEXT wglGetSwapIntervalEXT;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr AllocateMemoryNV(Int32 size, Single readfreq, Single writefreq, Single priority);
|
||||
internal unsafe static AllocateMemoryNV wglAllocateMemoryNV;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate void FreeMemoryNV([Out] IntPtr pointer);
|
||||
internal static FreeMemoryNV wglFreeMemoryNV;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetSyncValuesOML(IntPtr hdc, [Out] Int64* ust, [Out] Int64* msc, [Out] Int64* sbc);
|
||||
internal unsafe static GetSyncValuesOML wglGetSyncValuesOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetMscRateOML(IntPtr hdc, [Out] Int32* numerator, [Out] Int32* denominator);
|
||||
internal unsafe static GetMscRateOML wglGetMscRateOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Int64 SwapBuffersMscOML(IntPtr hdc, Int64 target_msc, Int64 divisor, Int64 remainder);
|
||||
internal static SwapBuffersMscOML wglSwapBuffersMscOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Int64 SwapLayerBuffersMscOML(IntPtr hdc, int fuPlanes, Int64 target_msc, Int64 divisor, Int64 remainder);
|
||||
internal static SwapLayerBuffersMscOML wglSwapLayerBuffersMscOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean WaitForMscOML(IntPtr hdc, Int64 target_msc, Int64 divisor, Int64 remainder, [Out] Int64* ust, [Out] Int64* msc, [Out] Int64* sbc);
|
||||
internal unsafe static WaitForMscOML wglWaitForMscOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean WaitForSbcOML(IntPtr hdc, Int64 target_sbc, [Out] Int64* ust, [Out] Int64* msc, [Out] Int64* sbc);
|
||||
internal unsafe static WaitForSbcOML wglWaitForSbcOML;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetDigitalVideoParametersI3D(IntPtr hDC, int iAttribute, [Out] int* piValue);
|
||||
internal unsafe static GetDigitalVideoParametersI3D wglGetDigitalVideoParametersI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean SetDigitalVideoParametersI3D(IntPtr hDC, int iAttribute, int* piValue);
|
||||
internal unsafe static SetDigitalVideoParametersI3D wglSetDigitalVideoParametersI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGammaTableParametersI3D(IntPtr hDC, int iAttribute, [Out] int* piValue);
|
||||
internal unsafe static GetGammaTableParametersI3D wglGetGammaTableParametersI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean SetGammaTableParametersI3D(IntPtr hDC, int iAttribute, int* piValue);
|
||||
internal unsafe static SetGammaTableParametersI3D wglSetGammaTableParametersI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGammaTableI3D(IntPtr hDC, int iEntries, [Out] UInt16* puRed, [Out] UInt16* puGreen, [Out] UInt16* puBlue);
|
||||
internal unsafe static GetGammaTableI3D wglGetGammaTableI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean SetGammaTableI3D(IntPtr hDC, int iEntries, UInt16* puRed, UInt16* puGreen, UInt16* puBlue);
|
||||
internal unsafe static SetGammaTableI3D wglSetGammaTableI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean EnableGenlockI3D(IntPtr hDC);
|
||||
internal static EnableGenlockI3D wglEnableGenlockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DisableGenlockI3D(IntPtr hDC);
|
||||
internal static DisableGenlockI3D wglDisableGenlockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean IsEnabledGenlockI3D(IntPtr hDC, [Out] Boolean* pFlag);
|
||||
internal unsafe static IsEnabledGenlockI3D wglIsEnabledGenlockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceI3D(IntPtr hDC, UInt32 uSource);
|
||||
internal static GenlockSourceI3D wglGenlockSourceI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGenlockSourceI3D(IntPtr hDC, [Out] UInt32* uSource);
|
||||
internal unsafe static GetGenlockSourceI3D wglGetGenlockSourceI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceEdgeI3D(IntPtr hDC, UInt32 uEdge);
|
||||
internal static GenlockSourceEdgeI3D wglGenlockSourceEdgeI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGenlockSourceEdgeI3D(IntPtr hDC, [Out] UInt32* uEdge);
|
||||
internal unsafe static GetGenlockSourceEdgeI3D wglGetGenlockSourceEdgeI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSampleRateI3D(IntPtr hDC, UInt32 uRate);
|
||||
internal static GenlockSampleRateI3D wglGenlockSampleRateI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGenlockSampleRateI3D(IntPtr hDC, [Out] UInt32* uRate);
|
||||
internal unsafe static GetGenlockSampleRateI3D wglGetGenlockSampleRateI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceDelayI3D(IntPtr hDC, UInt32 uDelay);
|
||||
internal static GenlockSourceDelayI3D wglGenlockSourceDelayI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetGenlockSourceDelayI3D(IntPtr hDC, [Out] UInt32* uDelay);
|
||||
internal unsafe static GetGenlockSourceDelayI3D wglGetGenlockSourceDelayI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean QueryGenlockMaxSourceDelayI3D(IntPtr hDC, [Out] UInt32* uMaxLineDelay, [Out] UInt32* uMaxPixelDelay);
|
||||
internal unsafe static QueryGenlockMaxSourceDelayI3D wglQueryGenlockMaxSourceDelayI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreateImageBufferI3D(IntPtr hDC, Int32 dwSize, UInt32 uFlags);
|
||||
internal unsafe static CreateImageBufferI3D wglCreateImageBufferI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DestroyImageBufferI3D(IntPtr hDC, IntPtr pAddress);
|
||||
internal static DestroyImageBufferI3D wglDestroyImageBufferI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean AssociateImageBufferEventsI3D(IntPtr hDC, IntPtr* pEvent, IntPtr pAddress, Int32* pSize, UInt32 count);
|
||||
internal unsafe static AssociateImageBufferEventsI3D wglAssociateImageBufferEventsI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean ReleaseImageBufferEventsI3D(IntPtr hDC, IntPtr pAddress, UInt32 count);
|
||||
internal static ReleaseImageBufferEventsI3D wglReleaseImageBufferEventsI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean EnableFrameLockI3D();
|
||||
internal static EnableFrameLockI3D wglEnableFrameLockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DisableFrameLockI3D();
|
||||
internal static DisableFrameLockI3D wglDisableFrameLockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean IsEnabledFrameLockI3D([Out] Boolean* pFlag);
|
||||
internal unsafe static IsEnabledFrameLockI3D wglIsEnabledFrameLockI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean QueryFrameLockMasterI3D([Out] Boolean* pFlag);
|
||||
internal unsafe static QueryFrameLockMasterI3D wglQueryFrameLockMasterI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetFrameUsageI3D([Out] float* pUsage);
|
||||
internal unsafe static GetFrameUsageI3D wglGetFrameUsageI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean BeginFrameTrackingI3D();
|
||||
internal static BeginFrameTrackingI3D wglBeginFrameTrackingI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean EndFrameTrackingI3D();
|
||||
internal static EndFrameTrackingI3D wglEndFrameTrackingI3D;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean QueryFrameTrackingI3D([Out] Int32* pFrameCount, [Out] Int32* pMissedFrames, [Out] float* pLastMissedUsage);
|
||||
internal unsafe static QueryFrameTrackingI3D wglQueryFrameTrackingI3D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace OpenTK.Platform.Windows
|
|||
assembly = Assembly.GetExecutingAssembly();
|
||||
wglClass = assembly.GetType("OpenTK.Platform.Windows.Wgl");
|
||||
delegatesClass = wglClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
importsClass = wglClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
//// Ensure core entry points are ready prior to accessing any method.
|
||||
//// Resolves bug [#993]: "Possible bug in GraphicsContext.CreateDummyContext()"
|
||||
|
@ -38,7 +37,6 @@ namespace OpenTK.Platform.Windows
|
|||
private static Assembly assembly;
|
||||
private static Type wglClass;
|
||||
private static Type delegatesClass;
|
||||
private static Type importsClass;
|
||||
|
||||
private static bool rebuildExtensionList = true;
|
||||
|
||||
|
@ -59,16 +57,7 @@ namespace OpenTK.Platform.Windows
|
|||
/// </returns>
|
||||
static Delegate LoadDelegate(string name, Type signature)
|
||||
{
|
||||
Delegate d;
|
||||
string realName = name.StartsWith("wgl") ? name.Substring(3) : name;
|
||||
|
||||
if (importsClass.GetMethod(realName,
|
||||
BindingFlags.NonPublic | BindingFlags.Static) != null)
|
||||
d = GetExtensionDelegate(name, signature) ??
|
||||
Delegate.CreateDelegate(signature, typeof(Imports), realName);
|
||||
else
|
||||
d = GetExtensionDelegate(name, signature);
|
||||
|
||||
Delegate d = GetExtensionDelegate(name, signature);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -87,7 +76,7 @@ namespace OpenTK.Platform.Windows
|
|||
/// </returns>
|
||||
private static Delegate GetExtensionDelegate(string name, Type signature)
|
||||
{
|
||||
IntPtr address = Imports.GetProcAddress(name);
|
||||
IntPtr address = GetProcAddress(name);
|
||||
|
||||
if (address == IntPtr.Zero ||
|
||||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
|
|||
SetGraphicsModePFD(selector, GraphicsMode.Default, window);
|
||||
|
||||
// Then, construct a temporary context and load all wgl extensions
|
||||
ContextHandle temp_context = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
|
||||
ContextHandle temp_context = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
|
||||
if (temp_context != ContextHandle.Zero)
|
||||
{
|
||||
// Make the context current.
|
||||
|
@ -79,7 +79,7 @@ namespace OpenTK.Platform.Windows
|
|||
// Sigh...
|
||||
for (int retry = 0; retry < 5; retry++)
|
||||
{
|
||||
bool success = Wgl.Imports.MakeCurrent(window.DeviceContext, temp_context.Handle);
|
||||
bool success = Wgl.MakeCurrent(window.DeviceContext, temp_context.Handle);
|
||||
if (!success)
|
||||
{
|
||||
Debug.Print("wglMakeCurrent failed with error: {0}. Retrying", Marshal.GetLastWin32Error());
|
||||
|
@ -94,8 +94,8 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
// Load wgl extensions and destroy temporary context
|
||||
Wgl.LoadAll();
|
||||
Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||
Wgl.Imports.DeleteContext(temp_context.Handle);
|
||||
Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||
Wgl.DeleteContext(temp_context.Handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,9 +168,9 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
// Failed to create GL3-level context, fall back to GL2.
|
||||
Debug.Write("Falling back to GL2... ");
|
||||
Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
|
||||
Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
|
||||
if (Handle == ContextHandle.Zero)
|
||||
Handle = new ContextHandle(Wgl.Imports.CreateContext(window.DeviceContext));
|
||||
Handle = new ContextHandle(Wgl.CreateContext(window.DeviceContext));
|
||||
if (Handle == ContextHandle.Zero)
|
||||
throw new GraphicsContextException(
|
||||
String.Format("Context creation failed. Wgl.CreateContext() error: {0}.",
|
||||
|
@ -193,7 +193,7 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
Marshal.GetLastWin32Error();
|
||||
Debug.Write(String.Format("Sharing state with context {0}: ", sharedContext));
|
||||
bool result = Wgl.Imports.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
|
||||
bool result = Wgl.ShareLists((sharedContext as IGraphicsContextInternal).Context.Handle, Handle.Handle);
|
||||
Debug.WriteLine(result ? "success!" : "failed with win32 error " + Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
@ -255,11 +255,11 @@ namespace OpenTK.Platform.Windows
|
|||
if (wnd.Handle == IntPtr.Zero)
|
||||
throw new ArgumentException("window", "Must point to a valid window.");
|
||||
|
||||
success = Wgl.Imports.MakeCurrent(wnd.DeviceContext, Handle.Handle);
|
||||
success = Wgl.MakeCurrent(wnd.DeviceContext, Handle.Handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||
success = Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
|
@ -274,7 +274,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public override bool IsCurrent
|
||||
{
|
||||
get { return Wgl.Imports.GetCurrentContext() == Handle.Handle; }
|
||||
get { return Wgl.GetCurrentContext() == Handle.Handle; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -338,7 +338,30 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public override IntPtr GetAddress(string function_string)
|
||||
{
|
||||
return Wgl.Imports.GetProcAddress(function_string);
|
||||
IntPtr address = Wgl.GetProcAddress(function_string);
|
||||
if (!IsValid(address))
|
||||
{
|
||||
address = Functions.GetProcAddress(opengl32Handle, function_string);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function_string)
|
||||
{
|
||||
IntPtr address = Wgl.GetProcAddress(function_string);
|
||||
if (!IsValid(address))
|
||||
{
|
||||
address = Functions.GetProcAddress(opengl32Handle, function_string);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
static bool IsValid(IntPtr address)
|
||||
{
|
||||
// See https://www.opengl.org/wiki/Load_OpenGL_Functions
|
||||
long a = address.ToInt64();
|
||||
bool is_valid = (a < -1 )|| (a > 3);
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -390,7 +413,7 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
get
|
||||
{
|
||||
return Wgl.Imports.GetCurrentDC();
|
||||
return Wgl.GetCurrentDC();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,7 +472,7 @@ namespace OpenTK.Platform.Windows
|
|||
try
|
||||
{
|
||||
// This will fail if the user calls Dispose() on thread X when the context is current on thread Y.
|
||||
if (!Wgl.Imports.DeleteContext(Handle.Handle))
|
||||
if (!Wgl.DeleteContext(Handle.Handle))
|
||||
Debug.Print("Failed to destroy OpenGL context {0}. Error: {1}",
|
||||
Handle.ToString(), Marshal.GetLastWin32Error());
|
||||
}
|
||||
|
|
|
@ -109,15 +109,9 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
static int DescribePixelFormat(IntPtr hdc, int ipfd, int cjpfd, ref PixelFormatDescriptor pfd)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (PixelFormatDescriptor* ppfd = &pfd)
|
||||
{
|
||||
// Note: DescribePixelFormat found in gdi32 is extremely slow
|
||||
// on nvidia, for some reason.
|
||||
return Wgl.Imports.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, ppfd);
|
||||
}
|
||||
}
|
||||
// Note: DescribePixelFormat found in gdi32 is extremely slow
|
||||
// on nvidia, for some reason.
|
||||
return Wgl.DescribePixelFormat(hdc, ipfd, (uint)cjpfd, out pfd);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -308,6 +308,9 @@ namespace OpenTK.Platform.X11
|
|||
[DllImport(Library, EntryPoint = "glXGetProcAddress")]
|
||||
public static extern IntPtr GetProcAddress([MarshalAs(UnmanagedType.LPTStr)] string procName);
|
||||
|
||||
[DllImport(Library, EntryPoint = "glXGetProcAddress")]
|
||||
public static extern IntPtr GetProcAddress(IntPtr procName);
|
||||
|
||||
[DllImport(Library, EntryPoint = "glXGetConfig")]
|
||||
public static extern int GetConfig(IntPtr dpy, ref XVisualInfo vis, GLXAttribute attrib, out int value);
|
||||
|
||||
|
|
|
@ -376,18 +376,6 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region GetAddress
|
||||
|
||||
public override IntPtr GetAddress(string function)
|
||||
{
|
||||
using (new XLock(Display))
|
||||
{
|
||||
return Glx.GetProcAddress(function);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadAll
|
||||
|
||||
public override void LoadAll()
|
||||
|
@ -403,11 +391,25 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region --- IGLContextInternal Members ---
|
||||
#region --- IGraphicsContextInternal Members ---
|
||||
|
||||
#region IWindowInfo IGLContextInternal.Info
|
||||
#region GetAddress
|
||||
|
||||
//IWindowInfo IGraphicsContextInternal.Info { get { return window; } }
|
||||
public override IntPtr GetAddress(string function)
|
||||
{
|
||||
using (new XLock(Display))
|
||||
{
|
||||
return Glx.GetProcAddress(function);
|
||||
}
|
||||
}
|
||||
|
||||
public override IntPtr GetAddress(IntPtr function)
|
||||
{
|
||||
using (new XLock(Display))
|
||||
{
|
||||
return Glx.GetProcAddress(function);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
49
Source/OpenTK/Properties/Resources.Designer.cs
generated
49
Source/OpenTK/Properties/Resources.Designer.cs
generated
|
@ -1,49 +0,0 @@
|
|||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 4.0.30319.17020
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenTK.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.Equals(null, resourceMan)) {
|
||||
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("OpenTK.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
43
Source/OpenTK/RewrittenAttribute.cs
Normal file
43
Source/OpenTK/RewrittenAttribute.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 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
|
||||
// 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;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
|
||||
class RewrittenAttribute : Attribute
|
||||
{
|
||||
internal bool Rewritten;
|
||||
|
||||
public RewrittenAttribute(bool rewritten)
|
||||
{
|
||||
Rewritten = rewritten;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
55
Source/OpenTK/SlotAttribute.cs
Normal file
55
Source/OpenTK/SlotAttribute.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
// Copyright (c) 2006 - 2013 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
|
||||
// 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;
|
||||
|
||||
namespace OpenTK
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the slot index for a wrapper function.
|
||||
/// This type supports OpenTK and should not be
|
||||
/// used in user code.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||
public class SlotAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the slot index for a wrapper function.
|
||||
/// </summary>
|
||||
internal int Slot;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance.
|
||||
/// </summary>
|
||||
/// <param name="index">The slot index for a wrapper function.</param>
|
||||
public SlotAttribute(int index)
|
||||
{
|
||||
Slot = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue