2009-08-11 14:21:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2009-08-11 20:16:28 +00:00
|
|
|
|
using System.Reflection;
|
2009-08-11 14:21:35 +00:00
|
|
|
|
|
|
|
|
|
namespace OpenTK.Compute.CL10
|
|
|
|
|
{
|
2009-08-11 20:16:28 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides access to the OpenCL 1.0 flat API.
|
|
|
|
|
/// </summary>
|
2009-08-11 14:21:35 +00:00
|
|
|
|
public partial class CL
|
|
|
|
|
{
|
2009-08-11 20:16:28 +00:00
|
|
|
|
#region Private Members
|
|
|
|
|
|
2009-08-11 14:21:35 +00:00
|
|
|
|
const string Library = "opencl.dll";
|
2009-08-11 20:16:28 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
static CL()
|
|
|
|
|
{
|
|
|
|
|
Type imports = typeof(CL).GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
|
|
|
|
|
FieldInfo[] delegates = typeof(CL).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic).GetFields(BindingFlags.Static | BindingFlags.NonPublic);
|
|
|
|
|
if (delegates == null || imports == null)
|
|
|
|
|
throw new Exception("[Internal Error] Failed to locate CL.Delegates. Please file a bug report at http://www.opentk.com/issues");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < delegates.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
MethodInfo method = imports.GetMethod(delegates[i].Name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic);
|
|
|
|
|
Delegate @new = Delegate.CreateDelegate(delegates[i].FieldType, method);
|
|
|
|
|
delegates[i].SetValue(null, @new);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2009-08-11 14:21:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|