From ea6a4479e5d2fe2530749252573924e7cb2610e8 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 11 Aug 2009 19:27:28 +0000 Subject: [PATCH] Removed hand-written OpenCL bindings in favor of generated ones. --- Source/OpenTK/Compute/CLHelper.cs | 4 +- Source/OpenTK/Compute/CommandQueue.cs | 177 ----------- Source/OpenTK/Compute/ComputeContext.cs | 51 ---- Source/OpenTK/Compute/Configuration.cs | 5 +- Source/OpenTK/Compute/Device.cs | 22 -- Source/OpenTK/Compute/Enums.cs | 373 ------------------------ Source/OpenTK/Compute/Event.cs | 27 -- Source/OpenTK/Compute/Kernel.cs | 54 ---- Source/OpenTK/Compute/Memory.cs | 72 ----- Source/OpenTK/Compute/Platform.cs | 21 -- Source/OpenTK/Compute/Profiler.cs | 77 ++--- Source/OpenTK/Compute/Program.cs | 67 ----- Source/OpenTK/Compute/Sampler.cs | 95 ++---- Source/OpenTK/Compute/Structs.cs | 10 - 14 files changed, 64 insertions(+), 991 deletions(-) diff --git a/Source/OpenTK/Compute/CLHelper.cs b/Source/OpenTK/Compute/CLHelper.cs index 0ebe1062..83e49c22 100644 --- a/Source/OpenTK/Compute/CLHelper.cs +++ b/Source/OpenTK/Compute/CLHelper.cs @@ -31,7 +31,5 @@ using System.Text; namespace OpenTK.Compute { - public static partial class CL - { - } + } diff --git a/Source/OpenTK/Compute/CommandQueue.cs b/Source/OpenTK/Compute/CommandQueue.cs index 6c1fe0ba..b7238756 100644 --- a/Source/OpenTK/Compute/CommandQueue.cs +++ b/Source/OpenTK/Compute/CommandQueue.cs @@ -30,182 +30,5 @@ 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 } diff --git a/Source/OpenTK/Compute/ComputeContext.cs b/Source/OpenTK/Compute/ComputeContext.cs index 88ddd4ae..7f15314e 100644 --- a/Source/OpenTK/Compute/ComputeContext.cs +++ b/Source/OpenTK/Compute/ComputeContext.cs @@ -31,56 +31,5 @@ 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 } diff --git a/Source/OpenTK/Compute/Configuration.cs b/Source/OpenTK/Compute/Configuration.cs index b5c0acfa..3c60a9e0 100644 --- a/Source/OpenTK/Compute/Configuration.cs +++ b/Source/OpenTK/Compute/Configuration.cs @@ -29,8 +29,5 @@ using System; namespace OpenTK.Compute { - internal static class Configuration - { - public const string Library = "opencl.dll"; - } + } diff --git a/Source/OpenTK/Compute/Device.cs b/Source/OpenTK/Compute/Device.cs index e98c2e62..676b2fe5 100644 --- a/Source/OpenTK/Compute/Device.cs +++ b/Source/OpenTK/Compute/Device.cs @@ -33,27 +33,5 @@ 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 } diff --git a/Source/OpenTK/Compute/Enums.cs b/Source/OpenTK/Compute/Enums.cs index 53660931..83e49c22 100644 --- a/Source/OpenTK/Compute/Enums.cs +++ b/Source/OpenTK/Compute/Enums.cs @@ -31,378 +31,5 @@ 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 : long - { - 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 : long - { - DeviceAddress32Bits = (1 << 0), - DeviceAddress64Bits = (1 << 1), - } - - [Flags] - public enum DeviceFpConfig : long - { - 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 : long - { - ExecKernel = (1 << 0), - ExecNativeFnAsKernel = (1 << 1), - } - - [Flags] - public enum CommandQueueProperties : long - { - 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 : long - { - 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 : long - { - 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, - } } diff --git a/Source/OpenTK/Compute/Event.cs b/Source/OpenTK/Compute/Event.cs index 30a2b37e..b7238756 100644 --- a/Source/OpenTK/Compute/Event.cs +++ b/Source/OpenTK/Compute/Event.cs @@ -30,32 +30,5 @@ 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 } diff --git a/Source/OpenTK/Compute/Kernel.cs b/Source/OpenTK/Compute/Kernel.cs index 62c14137..b7238756 100644 --- a/Source/OpenTK/Compute/Kernel.cs +++ b/Source/OpenTK/Compute/Kernel.cs @@ -30,59 +30,5 @@ 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 ErrorCode 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 } diff --git a/Source/OpenTK/Compute/Memory.cs b/Source/OpenTK/Compute/Memory.cs index c76418ff..b7238756 100644 --- a/Source/OpenTK/Compute/Memory.cs +++ b/Source/OpenTK/Compute/Memory.cs @@ -30,77 +30,5 @@ 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 ErrorCode 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 ErrorCode 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 ErrorCode 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 } diff --git a/Source/OpenTK/Compute/Platform.cs b/Source/OpenTK/Compute/Platform.cs index adeb22de..b7238756 100644 --- a/Source/OpenTK/Compute/Platform.cs +++ b/Source/OpenTK/Compute/Platform.cs @@ -30,26 +30,5 @@ 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 } diff --git a/Source/OpenTK/Compute/Profiler.cs b/Source/OpenTK/Compute/Profiler.cs index 8b555bf8..b7238756 100644 --- a/Source/OpenTK/Compute/Profiler.cs +++ b/Source/OpenTK/Compute/Profiler.cs @@ -1,49 +1,34 @@ -#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 - +#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 +using System.Runtime.InteropServices; - 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); - } +namespace OpenTK.Compute +{ - #endregion -} +} diff --git a/Source/OpenTK/Compute/Program.cs b/Source/OpenTK/Compute/Program.cs index a478af05..b7238756 100644 --- a/Source/OpenTK/Compute/Program.cs +++ b/Source/OpenTK/Compute/Program.cs @@ -30,72 +30,5 @@ 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 ErrorCode 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 ErrorCode 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 } diff --git a/Source/OpenTK/Compute/Sampler.cs b/Source/OpenTK/Compute/Sampler.cs index b18bba2b..b7238756 100644 --- a/Source/OpenTK/Compute/Sampler.cs +++ b/Source/OpenTK/Compute/Sampler.cs @@ -1,67 +1,34 @@ -#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 - +#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 +using System.Runtime.InteropServices; - 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); +namespace OpenTK.Compute +{ - // 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 - -} +} diff --git a/Source/OpenTK/Compute/Structs.cs b/Source/OpenTK/Compute/Structs.cs index 5d0cf6ad..40cb0a7b 100644 --- a/Source/OpenTK/Compute/Structs.cs +++ b/Source/OpenTK/Compute/Structs.cs @@ -190,14 +190,4 @@ namespace OpenTK.Compute #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; } } - } }