Added OpenTK.Compute namespace with OpenCL bindings.
This commit is contained in:
parent
45277bc494
commit
eb48960b18
14 changed files with 1540 additions and 0 deletions
10
Source/OpenTK/Compute/CLHelper.cs
Normal file
10
Source/OpenTK/Compute/CLHelper.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
public static partial class CL
|
||||
{
|
||||
}
|
||||
}
|
211
Source/OpenTK/Compute/CommandQueue.cs
Normal file
211
Source/OpenTK/Compute/CommandQueue.cs
Normal file
|
@ -0,0 +1,211 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_command_queue = IntPtr;
|
||||
using cl_context = IntPtr;
|
||||
using cl_device_id = IntPtr;
|
||||
using cl_event = IntPtr;
|
||||
using cl_mem = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
public partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateCommandQueue")]
|
||||
public static extern cl_command_queue CreateCommandQueue(cl_context context,
|
||||
cl_device_id device,
|
||||
CommandQueueProperties properties,
|
||||
out ErrorCode errorcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainCommandQueue")]
|
||||
public static extern int RetainCommandQueue(cl_command_queue command_queue);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseCommandQueue")]
|
||||
public static extern int ReleaseCommandQueue(cl_command_queue command_queue);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetCommandQueueInfo")]
|
||||
public static extern int GetCommandQueueInfo(cl_command_queue command_queue,
|
||||
CommandQueueInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ out IntPtr param_value_size_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clSetCommandQueueProperty")]
|
||||
public static extern int SetCommandQueueProperty(cl_command_queue command_queue,
|
||||
CommandQueueProperties properties,
|
||||
bool enable,
|
||||
out CommandQueueProperties old_properties);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueReadBuffer")]
|
||||
public static extern int EnqueueReadBuffer(cl_command_queue command_queue,
|
||||
cl_mem buffer,
|
||||
bool blocking_read,
|
||||
/* size_t */ IntPtr offset,
|
||||
/* size_t */ IntPtr cb,
|
||||
/* void * */ IntPtr ptr,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueWriteBuffer")]
|
||||
public static extern int EnqueueWriteBuffer(cl_command_queue command_queue,
|
||||
cl_mem buffer,
|
||||
bool blocking_write,
|
||||
/* size_t */ IntPtr offset,
|
||||
/* size_t */ IntPtr cb,
|
||||
/* void * */ IntPtr ptr,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueCopyBuffer")]
|
||||
public static extern int EnqueueCopyBuffer(cl_command_queue command_queue,
|
||||
cl_mem src_buffer,
|
||||
cl_mem dst_buffer,
|
||||
/* size_t */ IntPtr src_offset,
|
||||
/* size_t */ IntPtr dst_offset,
|
||||
/* size_t */ IntPtr cb,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueReadImage")]
|
||||
public static extern int EnqueueReadImage(cl_command_queue command_queue,
|
||||
cl_mem image,
|
||||
bool blocking_read,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
/* size_t */ IntPtr row_pitch,
|
||||
/* size_t */ IntPtr slice_pitch,
|
||||
/* void * */ IntPtr ptr,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueWriteImage")]
|
||||
public static extern int EnqueueWriteImage(cl_command_queue command_queue,
|
||||
cl_mem image,
|
||||
bool blocking_write,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
/* size_t */ IntPtr input_row_pitch,
|
||||
/* size_t */ IntPtr input_slice_pitch,
|
||||
/* void * */ IntPtr ptr,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueCopyImage")]
|
||||
public static extern int EnqueueCopyImage(cl_command_queue command_queue,
|
||||
cl_mem src_image,
|
||||
cl_mem dst_image,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] src_origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] dst_origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueCopyImageToBuffer")]
|
||||
public static extern int EnqueueCopyImageToBuffer(cl_command_queue command_queue,
|
||||
cl_mem src_image,
|
||||
cl_mem dst_buffer,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] src_origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
/* size_t */ IntPtr dst_offset,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueCopyBufferToImage")]
|
||||
public static extern int EnqueueCopyBufferToImage(cl_command_queue command_queue,
|
||||
cl_mem src_buffer,
|
||||
cl_mem dst_image,
|
||||
/* size_t */ IntPtr src_offset,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] dst_origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueMapBuffer")]
|
||||
public static extern IntPtr EnqueueMapBuffer(cl_command_queue command_queue,
|
||||
cl_mem buffer,
|
||||
bool blocking_map,
|
||||
MapFlags map_flags,
|
||||
/* size_t */ IntPtr offset,
|
||||
/* size_t */ IntPtr cb,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event,
|
||||
out ErrorCode errorcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clEnqueueMapImage")]
|
||||
public static extern IntPtr EnqueueMapImage(cl_command_queue command_queue,
|
||||
cl_mem image,
|
||||
bool blocking_map,
|
||||
MapFlags map_flags,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] origin,
|
||||
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)] /* size_t * */ IntPtr[] region,
|
||||
/* size_t * */ out IntPtr image_row_pitch,
|
||||
/* size_t * */ out IntPtr image_slice_pitch,
|
||||
int num_events_in_wait_list,
|
||||
cl_event[] event_wait_list,
|
||||
ref cl_event @event,
|
||||
out ErrorCode errorcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clFlush")]
|
||||
public static extern int Flush(cl_command_queue command_queue);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clFinish")]
|
||||
public static extern int Finish(cl_command_queue command_queue);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
86
Source/OpenTK/Compute/ComputeContext.cs
Normal file
86
Source/OpenTK/Compute/ComputeContext.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_context = IntPtr;
|
||||
using cl_device_id = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
public delegate void NotifyContext(string errinfo,
|
||||
/* const void * */ IntPtr private_info,
|
||||
/* size_t */ IntPtr cb,
|
||||
/* void * */ IntPtr user_data);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateContext")]
|
||||
public static extern cl_context CreateContext(
|
||||
IntPtr[] properties,
|
||||
int num_devices,
|
||||
cl_device_id[] devices,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] NotifyContext pfn_notify,
|
||||
IntPtr user_data, // void*
|
||||
out ErrorCode errorcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateContextFromType")]
|
||||
public static extern cl_context CreateContextFromType(
|
||||
IntPtr[] properties,
|
||||
DeviceType device_type,
|
||||
int num_devices,
|
||||
cl_device_id[] devices,
|
||||
[MarshalAs(UnmanagedType.FunctionPtr)] NotifyContext pfn_notify,
|
||||
/* void * */ IntPtr user_data,
|
||||
out ErrorCode errorcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainContext")]
|
||||
public static extern int RetainContext(cl_context context);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseContext")]
|
||||
public static extern int ReleaseContext(cl_context context);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetContextInfo")]
|
||||
public static extern int GetContextInfo(cl_context context,
|
||||
ContextInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
36
Source/OpenTK/Compute/Configuration.cs
Normal file
36
Source/OpenTK/Compute/Configuration.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
internal static class Configuration
|
||||
{
|
||||
public const string Library = "opencl.dll";
|
||||
}
|
||||
}
|
59
Source/OpenTK/Compute/Device.cs
Normal file
59
Source/OpenTK/Compute/Device.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_device_id = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetDeviceIDs"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern ErrorCode Getcl_device_ids(DeviceType deviceType,
|
||||
int numEntries,
|
||||
[Out] cl_device_id[] devices,
|
||||
out int numDevices);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetDeviceInfo"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern int GetDeviceInfo(cl_device_id device,
|
||||
DeviceInfo param_name,
|
||||
IntPtr param_value_size,
|
||||
IntPtr param_value,
|
||||
out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
408
Source/OpenTK/Compute/Enums.cs
Normal file
408
Source/OpenTK/Compute/Enums.cs
Normal file
|
@ -0,0 +1,408 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
public enum ErrorCode
|
||||
{
|
||||
Success = 0,
|
||||
DeviceNotFound = -1,
|
||||
DeviceNotAvailable = -2,
|
||||
DeviceCompilerNotAvailable = -3,
|
||||
MemObjectAllocationFailure = -4,
|
||||
OutOfResources = -5,
|
||||
OutOfHostMemory = -6,
|
||||
ProfilingInfoNotAvailable = -7,
|
||||
MemCopyOverlap = -8,
|
||||
ImageFormatMismatch = -9,
|
||||
ImageFormatNotSupported = -10,
|
||||
InvalidValue = -30,
|
||||
InvalidDeviceType = -31,
|
||||
InvalidDevice = -32,
|
||||
InvalidContext = -33,
|
||||
InvalidQueueProperties = -34,
|
||||
InvalidCommandQueue = -35,
|
||||
InvalidHostPtr = -36,
|
||||
InvalidMemObject = -37,
|
||||
InvalidImageFormatDescriptor = -38,
|
||||
InvalidImageSize = -39,
|
||||
InvalidSampler = -40,
|
||||
InvalidBinary = -41,
|
||||
InvalidBuildOptions = -42,
|
||||
InvalidProgram = -43,
|
||||
InvalidProgramExecutable = -44,
|
||||
InvalidKernelName = -45,
|
||||
InvalidKernel = -46,
|
||||
InvalidArgIndex = -47,
|
||||
InvalidArgValue = -48,
|
||||
InvalidArgSize = -49,
|
||||
InvalidKernelArgs = -50,
|
||||
InvalidWorkDimension = -51,
|
||||
InvalidWorkGroupSize = -52,
|
||||
InvalidWorkItemSize = -53,
|
||||
InvalidGlobalOffset = -54,
|
||||
InvalidEventWaitList = -55,
|
||||
InvalidEvent = -56,
|
||||
InvalidOperation = -57,
|
||||
InvalidGlObject = -58,
|
||||
InvalidBufferSize = -59,
|
||||
}
|
||||
|
||||
public enum Version
|
||||
{
|
||||
Version10 = 1,
|
||||
}
|
||||
|
||||
public enum Bool
|
||||
{
|
||||
False = 0,
|
||||
True = 1,
|
||||
}
|
||||
|
||||
public enum PlatformInfo
|
||||
{
|
||||
PlatformProfile = 0x0900,
|
||||
PlatformVersion = 0x0901,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DeviceType
|
||||
{
|
||||
DeviceTypeDefault = (1 << 0),
|
||||
DeviceTypeCpu = (1 << 1),
|
||||
DeviceTypeGpu = (1 << 2),
|
||||
DeviceTypeAccelerator = (1 << 3),
|
||||
DeviceTypeAll = unchecked((int)0xFFFFFFFF),
|
||||
}
|
||||
|
||||
public enum DeviceInfo
|
||||
{
|
||||
DeviceType = 0x1000,
|
||||
DeviceVendorId = 0x1001,
|
||||
DeviceMaxComputeUnits = 0x1002,
|
||||
DeviceMaxWorkItemDimensions = 0x1003,
|
||||
DeviceMaxWorkGroupSize = 0x1004,
|
||||
DeviceMaxWorkItemSizes = 0x1005,
|
||||
DevicePreferredVectorWidthChar = 0x1006,
|
||||
DevicePreferredVectorWidthShort = 0x1007,
|
||||
DevicePreferredVectorWidthInt = 0x1008,
|
||||
DevicePreferredVectorWidthLong = 0x1009,
|
||||
DevicePreferredVectorWidthFloat = 0x100A,
|
||||
DevicePreferredVectorWidthDouble = 0x100B,
|
||||
DeviceMaxClockFrequency = 0x100C,
|
||||
DeviceAddressBits = 0x100D,
|
||||
DeviceMaxReadImageArgs = 0x100E,
|
||||
DeviceMaxWriteImageArgs = 0x100F,
|
||||
DeviceMaxMemAllocSize = 0x1010,
|
||||
DeviceImage2dMaxWidth = 0x1011,
|
||||
DeviceImage2dMaxHeight = 0x1012,
|
||||
DeviceImage3dMaxWidth = 0x1013,
|
||||
DeviceImage3dMaxHeight = 0x1014,
|
||||
DeviceImage3dMaxDepth = 0x1015,
|
||||
DeviceImageSupport = 0x1016,
|
||||
DeviceMaxParameterSize = 0x1017,
|
||||
DeviceMaxSamplers = 0x1018,
|
||||
DeviceMemBaseAddrAlign = 0x1019,
|
||||
DeviceMaxDataTypeAlignSize = 0x101A,
|
||||
DeviceSingleFpConfig = 0x101B,
|
||||
DeviceGlobalMemCacheType = 0x101C,
|
||||
DeviceGlobalMemCachelineSize = 0x101D,
|
||||
DeviceGlobalMemCacheSize = 0x101E,
|
||||
DeviceGlobalMemSize = 0x101F,
|
||||
DeviceMaxConstantBufferSize = 0x1020,
|
||||
DeviceMaxConstantArgs = 0x1021,
|
||||
DeviceLocalMemType = 0x1022,
|
||||
DeviceLocalMemSize = 0x1023,
|
||||
DeviceErrorCorrectionSupport = 0x1024,
|
||||
DeviceProfilingTimerResolution = 0x1025,
|
||||
DeviceEndianLittle = 0x1026,
|
||||
DeviceAvailable = 0x1027,
|
||||
DeviceCompilerAvailable = 0x1028,
|
||||
DeviceExecutionCapabilities = 0x1029,
|
||||
DeviceQueueProperties = 0x102A,
|
||||
DeviceName = 0x102B,
|
||||
DeviceVendor = 0x102C,
|
||||
DriverVersion = 0x102D,
|
||||
DeviceProfile = 0x102E,
|
||||
DeviceVersion = 0x102F,
|
||||
DeviceExtensions = 0x1030,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DeviceAddressInfo
|
||||
{
|
||||
DeviceAddress32Bits = (1 << 0),
|
||||
DeviceAddress64Bits = (1 << 1),
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DeviceFpConfig
|
||||
{
|
||||
FpDenorm = (1 << 0),
|
||||
FpInfNan = (1 << 1),
|
||||
FpRoundToNearest = (1 << 2),
|
||||
FpRoundToZero = (1 << 3),
|
||||
FpRoundToInf = (1 << 4),
|
||||
FpFma = (1 << 5),
|
||||
}
|
||||
|
||||
public enum DeviceMemCacheType
|
||||
{
|
||||
None = 0x0,
|
||||
ReadOnlyCache = 0x1,
|
||||
ReadWriteCache = 0x2,
|
||||
}
|
||||
|
||||
public enum DeviceLocalMemType
|
||||
{
|
||||
Local = 0x1,
|
||||
Global = 0x2,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DeviceExecCapabilities
|
||||
{
|
||||
ExecKernel = (1 << 0),
|
||||
ExecNativeFnAsKernel = (1 << 1),
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CommandQueueProperties
|
||||
{
|
||||
QueueOutOfOrderExecModeEnable = (1 << 0),
|
||||
QueueProfilingEnable = (1 << 1),
|
||||
}
|
||||
|
||||
public enum ContextInfo
|
||||
{
|
||||
ContextReferenceCount = 0x1080,
|
||||
ContextNumDevices = 0x1081,
|
||||
ContextDevices = 0x1082,
|
||||
ContextProperties = 0x1083,
|
||||
}
|
||||
|
||||
public enum CommandQueueInfo
|
||||
{
|
||||
QueueContext = 0x1090,
|
||||
QueueDevice = 0x1091,
|
||||
QueueReferenceCount = 0x1092,
|
||||
QueueProperties = 0x1093,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MemFlags
|
||||
{
|
||||
MemReadWrite = (1 << 0),
|
||||
MemWriteOnly = (1 << 1),
|
||||
MemReadOnly = (1 << 2),
|
||||
MemUseHostPtr = (1 << 3),
|
||||
MemAllocHostPtr = (1 << 4),
|
||||
MemCopyHostPtr = (1 << 5),
|
||||
}
|
||||
|
||||
public enum ChannelOrder
|
||||
{
|
||||
R = 0x10B0,
|
||||
A = 0x10B1,
|
||||
Rg = 0x10B2,
|
||||
Ra = 0x10B3,
|
||||
Rgb = 0x10B4,
|
||||
Rgba = 0x10B5,
|
||||
Bgra = 0x10B6,
|
||||
Argb = 0x10B7,
|
||||
}
|
||||
|
||||
public enum ChannelType
|
||||
{
|
||||
SnormInt8 = 0x10D0,
|
||||
SnormInt16 = 0x10D1,
|
||||
UnormInt8 = 0x10D2,
|
||||
UnormInt16 = 0x10D3,
|
||||
UnormShort565 = 0x10D4,
|
||||
UnormShort555 = 0x10D5,
|
||||
UnormInt101010 = 0x10D6,
|
||||
SignedInt8 = 0x10D7,
|
||||
SignedInt16 = 0x10D8,
|
||||
SignedInt32 = 0x10D9,
|
||||
UnsignedInt8 = 0x10DA,
|
||||
UnsignedInt16 = 0x10DB,
|
||||
UnsignedInt32 = 0x10DC,
|
||||
HalfFloat = 0x10DD,
|
||||
Float = 0x10DE,
|
||||
}
|
||||
|
||||
public enum MemObjectType
|
||||
{
|
||||
MemObjectBuffer = 0x10F0,
|
||||
MemObjectImage2d = 0x10F1,
|
||||
MemObjectImage3d = 0x10F2,
|
||||
}
|
||||
|
||||
public enum MemInfo
|
||||
{
|
||||
MemType = 0x1100,
|
||||
MemFlags = 0x1101,
|
||||
MemSize = 0x1102,
|
||||
MemHostPtr = 0x1103,
|
||||
MemMapCount = 0x1104,
|
||||
MemReferenceCount = 0x1105,
|
||||
MemContext = 0x1106,
|
||||
}
|
||||
|
||||
public enum ImageInfo
|
||||
{
|
||||
ImageFormat = 0x1110,
|
||||
ImageElementSize = 0x1111,
|
||||
ImageRowPitch = 0x1112,
|
||||
ImageSlicePitch = 0x1113,
|
||||
ImageWidth = 0x1114,
|
||||
ImageHeight = 0x1115,
|
||||
ImageDepth = 0x1116,
|
||||
}
|
||||
|
||||
public enum AddressingMode
|
||||
{
|
||||
AddressNone = 0x1130,
|
||||
AddressClampToEdge = 0x1131,
|
||||
AddressClamp = 0x1132,
|
||||
AddressRepeat = 0x1133,
|
||||
}
|
||||
|
||||
public enum FilterMode
|
||||
{
|
||||
FilterNearest = 0x1140,
|
||||
FilterLinear = 0x1141,
|
||||
}
|
||||
|
||||
public enum SamplerInfo
|
||||
{
|
||||
SamplerReferenceCount = 0x1150,
|
||||
SamplerContext = 0x1151,
|
||||
SamplerNormalizedCoords = 0x1152,
|
||||
SamplerAddressingMode = 0x1153,
|
||||
SamplerFilterMode = 0x1154,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MapFlags
|
||||
{
|
||||
MapRead = (1 << 0),
|
||||
MapWrite = (1 << 1),
|
||||
}
|
||||
|
||||
public enum ProgramInfo
|
||||
{
|
||||
ProgramReferenceCount = 0x1160,
|
||||
ProgramContext = 0x1161,
|
||||
ProgramNumDevices = 0x1162,
|
||||
ProgramDevices = 0x1163,
|
||||
ProgramSource = 0x1164,
|
||||
ProgramBinarySizes = 0x1165,
|
||||
ProgramBinaries = 0x1166,
|
||||
}
|
||||
|
||||
public enum ProgramBuildInfo
|
||||
{
|
||||
ProgramBuildStatus = 0x1181,
|
||||
ProgramBuildOptions = 0x1182,
|
||||
ProgramBuildLog = 0x1183,
|
||||
}
|
||||
|
||||
public enum BuildStatus
|
||||
{
|
||||
BuildSuccess = 0,
|
||||
BuildNone = -1,
|
||||
BuildError = -2,
|
||||
BuildInProgress = -3,
|
||||
}
|
||||
|
||||
public enum KernelInfo
|
||||
{
|
||||
KernelFunctionName = 0x1190,
|
||||
KernelNumArgs = 0x1191,
|
||||
KernelReferenceCount = 0x1192,
|
||||
KernelContext = 0x1193,
|
||||
KernelProgram = 0x1194,
|
||||
}
|
||||
|
||||
public enum KernelWorkGroupInfo
|
||||
{
|
||||
KernelWorkGroupSize = 0x11B0,
|
||||
KernelCompileWorkGroupSize = 0x11B1,
|
||||
}
|
||||
|
||||
public enum EventInfo
|
||||
{
|
||||
EventCommandQueue = 0x11D0,
|
||||
EventCommandType = 0x11D1,
|
||||
EventReferenceCount = 0x11D2,
|
||||
EventCommandExecutionStatus = 0x11D3,
|
||||
}
|
||||
|
||||
public enum CommandType
|
||||
{
|
||||
CommandNdrangeKernel = 0x11F0,
|
||||
CommandTask = 0x11F1,
|
||||
CommandNativeKernel = 0x11F2,
|
||||
CommandReadBuffer = 0x11F3,
|
||||
CommandWriteBuffer = 0x11F4,
|
||||
CommandCopyBuffer = 0x11F5,
|
||||
CommandReadImage = 0x11F6,
|
||||
CommandWriteImage = 0x11F7,
|
||||
CommandCopyImage = 0x11F8,
|
||||
CommandCopyImageToBuffer = 0x11F9,
|
||||
CommandCopyBufferToImage = 0x11FA,
|
||||
CommandMapBuffer = 0x11FB,
|
||||
CommandMapImage = 0x11FC,
|
||||
CommandUnmapMemObject = 0x11FD,
|
||||
CommandMarker = 0x11FE,
|
||||
CommandWaitForEvents = 0x11FF,
|
||||
CommandBarrier = 0x1200,
|
||||
CommandAcquireGlObjects = 0x1201,
|
||||
CommandReleaseGlObjects = 0x1202,
|
||||
}
|
||||
|
||||
public enum CommandExecutionStatus
|
||||
{
|
||||
Complete = 0x0,
|
||||
Running = 0x1,
|
||||
Submitted = 0x2,
|
||||
Queued = 0x3,
|
||||
}
|
||||
|
||||
public enum ProfilingInfo
|
||||
{
|
||||
ProfilingCommandQueued = 0x1280,
|
||||
ProfilingCommandSubmit = 0x1281,
|
||||
ProfilingCommandStart = 0x1282,
|
||||
ProfilingCommandEnd = 0x1283,
|
||||
}
|
||||
}
|
61
Source/OpenTK/Compute/Event.cs
Normal file
61
Source/OpenTK/Compute/Event.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_event = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clWaitForEvents")]
|
||||
public static extern int WaitForEvents(int num_events, ref cl_event event_list);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetEventInfo")]
|
||||
public static extern int GetEventInfo(cl_event id,
|
||||
EventInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t* */ IntPtr param_value_size_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainEvent")]
|
||||
public static extern int RetainEvent(cl_event @event);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseEvent")]
|
||||
public static extern int ReleaseEvent(cl_event @event);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
88
Source/OpenTK/Compute/Kernel.cs
Normal file
88
Source/OpenTK/Compute/Kernel.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_device_id = IntPtr;
|
||||
using cl_kernel = IntPtr;
|
||||
using cl_program = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateKernel")]
|
||||
public static extern cl_kernel CreateKernel(cl_program program,
|
||||
string kernel_name,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateKernelsInProgram")]
|
||||
public static extern int CreateKernels(cl_program program,
|
||||
int num_kernels,
|
||||
cl_kernel[] kernels,
|
||||
out int num_kernels_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainKernel")]
|
||||
public static extern int RetainKernel(cl_kernel kernel);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseKernel")]
|
||||
public static extern int ReleaseKernel(cl_kernel kernel);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clSetKernelArg")]
|
||||
public static extern int SetKernelArg(cl_kernel kernel,
|
||||
int arg_index,
|
||||
/* size_t */ IntPtr arg_size,
|
||||
/* const void * */ IntPtr arg_value);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetKernelInfo")]
|
||||
public static extern int GetKernelInfo(cl_kernel kernel,
|
||||
KernelInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ IntPtr param_value_size_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetKernelWorkGroupInfo")]
|
||||
public static extern int GetKernelWorkGroupInfo(cl_kernel kernel,
|
||||
cl_device_id device,
|
||||
KernelWorkGroupInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
106
Source/OpenTK/Compute/Memory.cs
Normal file
106
Source/OpenTK/Compute/Memory.cs
Normal file
|
@ -0,0 +1,106 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_context = IntPtr;
|
||||
using cl_mem = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateBuffer")]
|
||||
public static extern cl_mem CreateBuffer(cl_context context,
|
||||
MemFlags flags,
|
||||
/* size_t */ IntPtr size,
|
||||
/* void * */ IntPtr host_ptr,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateImage2D")]
|
||||
public static extern cl_mem CreateImage2D(cl_context context,
|
||||
MemFlags flags,
|
||||
ref ImageFormat image_format,
|
||||
/* size_t */ IntPtr image_width,
|
||||
/* size_t */ IntPtr image_height,
|
||||
/* size_t */ IntPtr image_row_pitch,
|
||||
/* void * */ IntPtr host_ptr,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateImage3D")]
|
||||
public static extern cl_mem CreateImage3D(cl_context context,
|
||||
MemFlags flags,
|
||||
ref ImageFormat image_format,
|
||||
/* size_t */ IntPtr image_width,
|
||||
/* size_t */ IntPtr image_height,
|
||||
/* size_t */ IntPtr image_row_pitch,
|
||||
/* size_t */ IntPtr image_slice_pitch,
|
||||
/* void * */ IntPtr host_ptr,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainMemObject")]
|
||||
public static extern int RetainMemObject(cl_mem memobj);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseMemObject")]
|
||||
public static extern int ReleaseMemObject(cl_mem memobj);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetSupportedImageFormats")]
|
||||
public static extern int GetSupportedImageFormats(cl_context context,
|
||||
MemFlags flags,
|
||||
MemObjectType image_type,
|
||||
int num_entries,
|
||||
ref ImageFormat image_formats,
|
||||
out int num_image_formats);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetMemObjectInfo")]
|
||||
public static extern int GetMemObjectInfo(cl_mem memobj,
|
||||
MemInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ out IntPtr param_value_size_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetImageInfo")]
|
||||
public static extern int GetImageInfo(cl_mem image,
|
||||
ImageInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t * */ out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
55
Source/OpenTK/Compute/Platform.cs
Normal file
55
Source/OpenTK/Compute/Platform.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_platform_id = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetPlatformIDs")]
|
||||
public static extern int GetPlatformIDs(int num_entries,
|
||||
[Out] cl_platform_id[] platforms,
|
||||
out int num_platforms);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetPlatformInfo")]
|
||||
public static extern int GetPlatformInfo(cl_platform_id platform,
|
||||
PlatformInfo param_name,
|
||||
/* size_t */ IntPtr param_value_size,
|
||||
/* void * */ IntPtr param_value,
|
||||
/* size_t* */ out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
49
Source/OpenTK/Compute/Profiler.cs
Normal file
49
Source/OpenTK/Compute/Profiler.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_event = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetEventProfilingInfo")]
|
||||
public static extern int GetEventProfilingInfo(cl_event @event,
|
||||
ProfilingInfo param_name,
|
||||
IntPtr param_value_size,
|
||||
IntPtr param_value,
|
||||
out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
101
Source/OpenTK/Compute/Program.cs
Normal file
101
Source/OpenTK/Compute/Program.cs
Normal file
|
@ -0,0 +1,101 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_context = IntPtr;
|
||||
using cl_device_id = IntPtr;
|
||||
using cl_program = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
public delegate void NotifyProgram(cl_program program, IntPtr user_data);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateProgramWithSource")]
|
||||
public static extern cl_program CreateProgramWithSource(cl_context context,
|
||||
int count,
|
||||
string[] strings,
|
||||
IntPtr[] lengths,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateProgramWithBinary")]
|
||||
public static extern cl_program CreateProgramWithBinary(cl_context context,
|
||||
int num_devices,
|
||||
cl_device_id[] device_list,
|
||||
IntPtr[] lengths,
|
||||
byte[][] binaries,
|
||||
out int binary_status,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainProgram")]
|
||||
public static extern int RetainProgram(cl_program program);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseProgram")]
|
||||
public static extern int ReleaseProgram(cl_program program);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clBuildProgram")]
|
||||
public static extern int BuildProgram(cl_program program,
|
||||
int num_devices,
|
||||
cl_device_id[] device_list,
|
||||
string options,
|
||||
NotifyProgram pfn_notify,
|
||||
IntPtr user_data);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clUnloadCompiler")]
|
||||
public static extern int UnloadCompiler();
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetProgramInfo")]
|
||||
public static extern int GetProgramInfo(cl_program program,
|
||||
ProgramInfo param_name,
|
||||
IntPtr param_value_size,
|
||||
IntPtr param_value,
|
||||
out IntPtr param_value_size_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetProgramBuildInfo")]
|
||||
public static extern int GetProgramBuildInfo(cl_program program,
|
||||
cl_device_id device,
|
||||
ProgramBuildInfo param_name,
|
||||
IntPtr param_value_size,
|
||||
IntPtr param_value,
|
||||
out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
67
Source/OpenTK/Compute/Sampler.cs
Normal file
67
Source/OpenTK/Compute/Sampler.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
using cl_context = IntPtr;
|
||||
using cl_sampler = IntPtr;
|
||||
|
||||
#region Flat API
|
||||
|
||||
partial class CL
|
||||
{
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clCreateSampler")]
|
||||
public static extern cl_sampler CreateSampler(cl_context context,
|
||||
bool normalized_coords,
|
||||
AddressingMode addressing_mode,
|
||||
FilterMode filter_mode,
|
||||
out int errcode_ret);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clRetainSampler")]
|
||||
public static extern int RetainSampler(cl_sampler sampler);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clReleaseSampler")]
|
||||
public static extern int ReleaseSampler(cl_sampler sampler);
|
||||
|
||||
// OpenCL 1.0
|
||||
[DllImport(Configuration.Library, EntryPoint = "clGetSamplerInfo")]
|
||||
public static extern int GetSamplerInfo(cl_sampler sampler,
|
||||
SamplerInfo param_name,
|
||||
IntPtr param_value_size,
|
||||
IntPtr param_value,
|
||||
out IntPtr param_value_size_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
203
Source/OpenTK/Compute/Structs.cs
Normal file
203
Source/OpenTK/Compute/Structs.cs
Normal file
|
@ -0,0 +1,203 @@
|
|||
#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
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Compute
|
||||
{
|
||||
#region struct Handle<T>
|
||||
|
||||
struct Handle<T> : IEquatable<Handle<T>>, IComparable<Handle<T>>
|
||||
{
|
||||
#region Fields
|
||||
|
||||
IntPtr handle;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a System.IntPtr that represents the handle of this ContextHandle.
|
||||
/// </summary>
|
||||
public IntPtr Value { get { return handle; } }
|
||||
|
||||
/// <summary>A read-only field that represents a handle that has been initialized to zero.</summary>
|
||||
public static readonly Handle<T> Zero = new Handle<T>(IntPtr.Zero);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance with the specified handle.
|
||||
/// </summary>
|
||||
/// <param name="h">A System.IntPtr containing the value for this instance.</param>
|
||||
public Handle(IntPtr h) { handle = h; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
|
||||
#region ToString
|
||||
|
||||
/// <summary>
|
||||
/// Converts this instance to its equivalent string representation.
|
||||
/// </summary>
|
||||
/// <returns>A System.String that contains the string representation of this instance.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Value.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Compares this instance to the specified object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The System.Object to compare to.</param>
|
||||
/// <returns>True if obj is a ContextHandle that is equal to this instance; false otherwise.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Handle<T>)
|
||||
return this.Equals((Handle<T>)obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns the hash code for this instance.
|
||||
/// </summary>
|
||||
/// <returns>A System.Int32 with the hash code of this instance.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Value.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static explicit operator IntPtr(Handle<T> c)
|
||||
|
||||
/// <summary>
|
||||
/// Converts the specified ContextHandle to the equivalent IntPtr.
|
||||
/// </summary>
|
||||
/// <param name="c">The ContextHandle to convert.</param>
|
||||
/// <returns>A System.IntPtr equivalent to the specified ContextHandle.</returns>
|
||||
public static explicit operator IntPtr(Handle<T> c)
|
||||
{
|
||||
return c != Handle<T>.Zero ? c.Value : IntPtr.Zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static explicit operator Handle<T>(IntPtr p)
|
||||
|
||||
/// <summary>
|
||||
/// Converts the specified IntPtr to the equivalent ContextHandle.
|
||||
/// </summary>
|
||||
/// <param name="p">The System.IntPtr to convert.</param>
|
||||
/// <returns>A ContextHandle equivalent to the specified IntPtr.</returns>
|
||||
public static explicit operator Handle<T>(IntPtr p)
|
||||
{
|
||||
return new Handle<T>(p);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances for equality.
|
||||
/// </summary>
|
||||
/// <param name="left">The instance to compare.</param>
|
||||
/// <param name="right">The instance to compare to.</param>
|
||||
/// <returns>True if left is equal to right; false otherwise.</returns>
|
||||
public static bool operator ==(Handle<T> left, Handle<T> right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances for inequality.
|
||||
/// </summary>
|
||||
/// <param name="left">The instance to compare.</param>
|
||||
/// <param name="right">The instance to compare to.</param>
|
||||
/// <returns>True if left is not equal to right; false otherwise.</returns>
|
||||
public static bool operator !=(Handle<T> left, Handle<T> right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IComparable<Handle<T>> Members
|
||||
|
||||
/// <summary>
|
||||
/// Compares the numerical value of this instance to other and returns a value indicating their relative order.
|
||||
/// </summary>
|
||||
/// <param name="other">The instance to compare to.</param>
|
||||
/// <returns>Less than 0, if this instance is less than other; 0 if both are equal; Greater than 0 if other is greater than this instance.</returns>
|
||||
public int CompareTo(Handle<T> other)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
return Value.ToInt64().CompareTo(other.Value.ToInt64());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEquatable<Handle<T>> Members
|
||||
|
||||
/// <summary>
|
||||
/// Compares this instance to the specified ContextHandle for equality.
|
||||
/// </summary>
|
||||
/// <param name="other">The ContextHandle to compare to.</param>
|
||||
/// <returns>True if this instance is equal to other; false otherwise.</returns>
|
||||
public bool Equals(Handle<T> other)
|
||||
{
|
||||
return Value == other.Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct ImageFormat
|
||||
{
|
||||
ChannelOrder image_channel_order;
|
||||
ChannelType image_channel_data_type;
|
||||
|
||||
public ChannelOrder ChannelOrder { get { return image_channel_order; } set { image_channel_order = value; } }
|
||||
|
||||
public ChannelType ChannelType { get { return image_channel_data_type; } set { image_channel_data_type = value; } }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue