changeset 0:3cea44337083

initial commit
author Trass3r
date Wed, 02 Dec 2009 17:40:59 +0100
parents
children 5b5ace425b37
files OpenCL.lib main.d opencl/c/cl_gl.d opencl/c/opencl.d opencl/c/orgHeaders/cl.h opencl/c/orgHeaders/cl_gl.h opencl/c/orgHeaders/cl_platform.h opencl/c/platform.d opencl/context.d opencl/device.d opencl/error.d opencl/platform.d opencl/program.d opencl/wrapper.d
diffstat 14 files changed, 3312 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file OpenCL.lib has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,33 @@
+module main;
+
+import common;
+
+import opencl.c.opencl;
+import opencl.context;
+import opencl.device;
+import opencl.platform;
+
+import std.stdio;
+
+void main(istring[] args)
+{
+	auto platform = CLPlatform.getPlatforms[0];
+	writefln("%s %s %s %s %s", platform.name, platform.vendor, platform.clversion, platform.profile, platform.extensions);
+
+	auto devices = platform.getDevices(CL_DEVICE_TYPE_ALL);
+	
+	foreach(device; devices)
+		writefln("%s %s %s %s %s", device.name, device.vendor, device.driverVersion, device.clVersion, device.profile, device.extensions);
+	
+	auto context = new CLContext(devices);
+	
+	auto program = context.createProgram(`
+			__kernel void sum(	__global const float* a,
+								__global const float* b,
+								__global float* c)
+			{
+				int i = get_global_id(0);
+				c[i] = a[i] + b[i];
+			} `).buildDebug();
+	
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/cl_gl.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,112 @@
+/**********************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **********************************************************************************/
+
+// $Revision: 8748 $ on $Date: 2009-08-27 04:24:36 -0700 (Thu, 27 Aug 2009) $
+
+module opencl.c.cl_gl;
+
+import opencl.c.platform;
+import opencl.c.opencl;
+
+extern(C):
+
+alias cl_uint     cl_gl_object_type;
+alias cl_uint     cl_gl_texture_info;
+alias cl_uint     cl_gl_platform_info;
+
+enum
+{
+	// cl_gl_object_type
+	CL_GL_OBJECT_BUFFER             = 0x2000,
+	CL_GL_OBJECT_TEXTURE2D          = 0x2001,
+	CL_GL_OBJECT_TEXTURE3D          = 0x2002,
+	CL_GL_OBJECT_RENDERBUFFER       = 0x2003,
+
+	// cl_gl_texture_info
+	CL_GL_TEXTURE_TARGET            = 0x2004,
+	CL_GL_MIPMAP_LEVEL              = 0x2005,
+}
+
+cl_mem clCreateFromGLBuffer(
+	cl_context     /* context */,
+	cl_mem_flags   /* flags */,
+	GLuint         /* bufobj */,
+	int*           /* errcode_ret */
+);
+
+cl_mem clCreateFromGLTexture2D(
+	cl_context      /* context */,
+	cl_mem_flags    /* flags */,
+	GLenum          /* target */,
+	GLint           /* miplevel */,
+	GLuint          /* texture */,
+	cl_int*            /* errcode_ret */
+);
+
+cl_mem clCreateFromGLTexture3D(
+	cl_context      /* context */,
+	cl_mem_flags    /* flags */,
+	GLenum          /* target */,
+	GLint           /* miplevel */,
+	GLuint          /* texture */,
+	cl_int*            /* errcode_ret */
+);
+
+cl_mem clCreateFromGLRenderbuffer(
+	cl_context   /* context */,
+	cl_mem_flags /* flags */,
+	GLuint       /* renderbuffer */,
+	cl_int*         /* errcode_ret */
+);
+
+cl_int clGetGLObjectInfo(
+	cl_mem                /* memobj */,
+	cl_gl_object_type*    /* gl_object_type */,
+	GLuint*               /* gl_object_name */
+);
+                  
+cl_int clGetGLTextureInfo(
+	cl_mem               /* memobj */,
+	cl_gl_texture_info   /* param_name */,
+	size_t               /* param_value_size */,
+	void*                /* param_value */,
+	size_t*              /* param_value_size_ret */
+);
+
+cl_int clEnqueueAcquireGLObjects(
+	cl_command_queue      /* queue */,
+	cl_uint               /* num_objects */,
+	const(cl_mem)*        /* mem_objects */,
+	cl_uint               /* num_events_in_wait_list */,
+	const(cl_event)*      /* event_wait_list */,
+	cl_event*             /* event */
+);
+
+cl_int clEnqueueReleaseGLObjects(
+	cl_command_queue      /* queue */,
+	cl_uint               /* num_objects */,
+	const(cl_mem)*        /* mem_objects */,
+	cl_uint               /* num_events_in_wait_list */,
+	const(cl_event)*      /* event_wait_list */,
+	cl_event*             /* event */
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/opencl.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,937 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ ******************************************************************************/
+
+// $Revision: 9283 $ on $Date: 2009-10-14 10:18:57 -0700 (Wed, 14 Oct 2009) $
+
+module opencl.c.opencl;
+
+public import opencl.c.platform;
+
+extern(C):
+
+alias const(void)*
+	cl_platform_id,
+	cl_device_id,
+	cl_context,
+	cl_command_queue,
+	cl_mem,
+	cl_program,
+	cl_kernel,
+	cl_event,
+	cl_sampler;
+
+alias cl_uint			cl_bool;		// WARNING!  Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels.
+alias cl_ulong			cl_bitfield;
+alias cl_bitfield		cl_device_type;
+alias cl_uint			cl_platform_info;
+alias cl_uint			cl_device_info;
+alias cl_bitfield		cl_device_address_info;
+alias cl_bitfield		cl_device_fp_config;
+alias cl_uint			cl_device_mem_cache_type;
+alias cl_uint			cl_device_local_mem_type;
+alias cl_bitfield		cl_device_exec_capabilities;
+alias cl_bitfield		cl_command_queue_properties;
+
+alias cl_bitfield		cl_context_properties;
+alias cl_uint			cl_context_info;
+alias cl_uint			cl_command_queue_info;
+alias cl_uint			cl_channel_order;
+alias cl_uint			cl_channel_type;
+alias cl_bitfield		cl_mem_flags;
+alias cl_uint			cl_mem_object_type;
+alias cl_uint			cl_mem_info;
+alias cl_uint			cl_image_info;
+alias cl_uint			cl_addressing_mode;
+alias cl_uint			cl_filter_mode;
+alias cl_uint			cl_sampler_info;
+alias cl_bitfield		cl_map_flags;
+alias cl_uint			cl_program_info;
+alias cl_uint			cl_program_build_info;
+alias cl_uint			cl_build_status;
+alias cl_uint			cl_kernel_info;
+alias cl_uint			cl_kernel_work_group_info;
+alias cl_uint			cl_event_info;
+alias cl_uint			cl_command_type;
+alias cl_uint			cl_profiling_info;
+
+struct cl_image_format
+{
+	cl_channel_order        image_channel_order;
+	cl_channel_type         image_channel_data_type;
+}
+
+/******************************************************************************/
+
+enum
+{
+	// Error Codes
+	CL_SUCCESS                                  = 0,
+	CL_DEVICE_NOT_FOUND                         = -1,
+	CL_DEVICE_NOT_AVAILABLE                     = -2,
+	CL_COMPILER_NOT_AVAILABLE                   = -3,
+	CL_MEM_OBJECT_ALLOCATION_FAILURE            = -4,
+	CL_OUT_OF_RESOURCES                         = -5,
+	CL_OUT_OF_HOST_MEMORY                       = -6,
+	CL_PROFILING_INFO_NOT_AVAILABLE             = -7,
+	CL_MEM_COPY_OVERLAP                         = -8,
+	CL_IMAGE_FORMAT_MISMATCH                    = -9,
+	CL_IMAGE_FORMAT_NOT_SUPPORTED               = -10,
+	CL_BUILD_PROGRAM_FAILURE                    = -11,
+	CL_MAP_FAILURE                              = -12,
+
+	CL_INVALID_VALUE                            = -30,
+	CL_INVALID_DEVICE_TYPE                      = -31,
+	CL_INVALID_PLATFORM                         = -32,
+	CL_INVALID_DEVICE                           = -33,
+	CL_INVALID_CONTEXT                          = -34,
+	CL_INVALID_QUEUE_PROPERTIES                 = -35,
+	CL_INVALID_COMMAND_QUEUE                    = -36,
+	CL_INVALID_HOST_PTR                         = -37,
+	CL_INVALID_MEM_OBJECT                       = -38,
+	CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          = -39,
+	CL_INVALID_IMAGE_SIZE                       = -40,
+	CL_INVALID_SAMPLER                          = -41,
+	CL_INVALID_BINARY                           = -42,
+	CL_INVALID_BUILD_OPTIONS                    = -43,
+	CL_INVALID_PROGRAM                          = -44,
+	CL_INVALID_PROGRAM_EXECUTABLE               = -45,
+	CL_INVALID_KERNEL_NAME                      = -46,
+	CL_INVALID_KERNEL_DEFINITION                = -47,
+	CL_INVALID_KERNEL                           = -48,
+	CL_INVALID_ARG_INDEX                        = -49,
+	CL_INVALID_ARG_VALUE                        = -50,
+	CL_INVALID_ARG_SIZE                         = -51,
+	CL_INVALID_KERNEL_ARGS                      = -52,
+	CL_INVALID_WORK_DIMENSION                   = -53,
+	CL_INVALID_WORK_GROUP_SIZE                  = -54,
+	CL_INVALID_WORK_ITEM_SIZE                   = -55,
+	CL_INVALID_GLOBAL_OFFSET                    = -56,
+	CL_INVALID_EVENT_WAIT_LIST                  = -57,
+	CL_INVALID_EVENT                            = -58,
+	CL_INVALID_OPERATION                        = -59,
+	CL_INVALID_GL_OBJECT                        = -60,
+	CL_INVALID_BUFFER_SIZE                      = -61,
+	CL_INVALID_MIP_LEVEL                        = -62,
+	CL_INVALID_GLOBAL_WORK_SIZE                 = -63,
+
+	// OpenCL Version
+	CL_VERSION_1_0                              = 1,
+
+	// cl_bool
+	CL_FALSE                                    = 0,
+	CL_TRUE                                     = 1,
+
+	// cl_platform_info
+	CL_PLATFORM_PROFILE                         = 0x0900,
+	CL_PLATFORM_VERSION                         = 0x0901,
+	CL_PLATFORM_NAME                            = 0x0902,
+	CL_PLATFORM_VENDOR                          = 0x0903,
+	CL_PLATFORM_EXTENSIONS                      = 0x0904,
+
+	// cl_device_type - bitfield
+	CL_DEVICE_TYPE_DEFAULT                      = (1 << 0),
+	CL_DEVICE_TYPE_CPU                          = (1 << 1),
+	CL_DEVICE_TYPE_GPU                          = (1 << 2),
+	CL_DEVICE_TYPE_ACCELERATOR                  = (1 << 3),
+	CL_DEVICE_TYPE_ALL                          = 0xFFFFFFFF,
+
+	// cl_device_info
+	CL_DEVICE_TYPE                              = 0x1000,
+	CL_DEVICE_VENDOR_ID                         = 0x1001,
+	CL_DEVICE_MAX_COMPUTE_UNITS                 = 0x1002,
+	CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          = 0x1003,
+	CL_DEVICE_MAX_WORK_GROUP_SIZE               = 0x1004,
+	CL_DEVICE_MAX_WORK_ITEM_SIZES               = 0x1005,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       = 0x1006,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      = 0x1007,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        = 0x1008,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       = 0x1009,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      = 0x100A,
+	CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     = 0x100B,
+	CL_DEVICE_MAX_CLOCK_FREQUENCY               = 0x100C,
+	CL_DEVICE_ADDRESS_BITS                      = 0x100D,
+	CL_DEVICE_MAX_READ_IMAGE_ARGS               = 0x100E,
+	CL_DEVICE_MAX_WRITE_IMAGE_ARGS              = 0x100F,
+	CL_DEVICE_MAX_MEM_ALLOC_SIZE                = 0x1010,
+	CL_DEVICE_IMAGE2D_MAX_WIDTH                 = 0x1011,
+	CL_DEVICE_IMAGE2D_MAX_HEIGHT                = 0x1012,
+	CL_DEVICE_IMAGE3D_MAX_WIDTH                 = 0x1013,
+	CL_DEVICE_IMAGE3D_MAX_HEIGHT                = 0x1014,
+	CL_DEVICE_IMAGE3D_MAX_DEPTH                 = 0x1015,
+	CL_DEVICE_IMAGE_SUPPORT                     = 0x1016,
+	CL_DEVICE_MAX_PARAMETER_SIZE                = 0x1017,
+	CL_DEVICE_MAX_SAMPLERS                      = 0x1018,
+	CL_DEVICE_MEM_BASE_ADDR_ALIGN               = 0x1019,
+	CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          = 0x101A,
+	CL_DEVICE_SINGLE_FP_CONFIG                  = 0x101B,
+	CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             = 0x101C,
+	CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         = 0x101D,
+	CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             = 0x101E,
+	CL_DEVICE_GLOBAL_MEM_SIZE                   = 0x101F,
+	CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          = 0x1020,
+	CL_DEVICE_MAX_CONSTANT_ARGS                 = 0x1021,
+	CL_DEVICE_LOCAL_MEM_TYPE                    = 0x1022,
+	CL_DEVICE_LOCAL_MEM_SIZE                    = 0x1023,
+	CL_DEVICE_ERROR_CORRECTION_SUPPORT          = 0x1024,
+	CL_DEVICE_PROFILING_TIMER_RESOLUTION        = 0x1025,
+	CL_DEVICE_ENDIAN_LITTLE                     = 0x1026,
+	CL_DEVICE_AVAILABLE                         = 0x1027,
+	CL_DEVICE_COMPILER_AVAILABLE                = 0x1028,
+	CL_DEVICE_EXECUTION_CAPABILITIES            = 0x1029,
+	CL_DEVICE_QUEUE_PROPERTIES                  = 0x102A,
+	CL_DEVICE_NAME                              = 0x102B,
+	CL_DEVICE_VENDOR                            = 0x102C,
+	CL_DRIVER_VERSION                           = 0x102D,
+	CL_DEVICE_PROFILE                           = 0x102E,
+	CL_DEVICE_VERSION                           = 0x102F,
+	CL_DEVICE_EXTENSIONS                        = 0x1030,
+	CL_DEVICE_PLATFORM                          = 0x1031,
+	
+	// cl_device_fp_config - bitfield
+	CL_FP_DENORM                                = (1 << 0),
+	CL_FP_INF_NAN                               = (1 << 1),
+	CL_FP_ROUND_TO_NEAREST                      = (1 << 2),
+	CL_FP_ROUND_TO_ZERO                         = (1 << 3),
+	CL_FP_ROUND_TO_INF                          = (1 << 4),
+	CL_FP_FMA                                   = (1 << 5),
+
+	// cl_device_mem_cache_type
+	CL_NONE                                     = 0x0,
+	CL_READ_ONLY_CACHE                          = 0x1,
+	CL_READ_WRITE_CACHE                         = 0x2,
+
+	// cl_device_local_mem_type
+	CL_LOCAL                                    = 0x1,
+	CL_GLOBAL                                   = 0x2,
+
+	// cl_device_exec_capabilities - bitfield
+	CL_EXEC_KERNEL                              = (1 << 0),
+	CL_EXEC_NATIVE_KERNEL                       = (1 << 1),
+
+	// cl_command_queue_properties - bitfield
+	CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      = (1 << 0),
+	CL_QUEUE_PROFILING_ENABLE                   = (1 << 1),
+
+	// cl_context_info
+	CL_CONTEXT_REFERENCE_COUNT                  = 0x1080,
+	CL_CONTEXT_DEVICES                          = 0x1081,
+	CL_CONTEXT_PROPERTIES                       = 0x1082,
+
+	// cl_context_properties
+	CL_CONTEXT_PLATFORM                         = 0x1084,
+
+	// cl_command_queue_info
+	CL_QUEUE_CONTEXT                            = 0x1090,
+	CL_QUEUE_DEVICE                             = 0x1091,
+	CL_QUEUE_REFERENCE_COUNT                    = 0x1092,
+	CL_QUEUE_PROPERTIES                         = 0x1093,
+
+	// cl_mem_flags - bitfield
+	CL_MEM_READ_WRITE                           = (1 << 0),
+	CL_MEM_WRITE_ONLY                           = (1 << 1),
+	CL_MEM_READ_ONLY                            = (1 << 2),
+	CL_MEM_USE_HOST_PTR                         = (1 << 3),
+	CL_MEM_ALLOC_HOST_PTR                       = (1 << 4),
+	CL_MEM_COPY_HOST_PTR                        = (1 << 5),
+
+	// cl_channel_order
+	CL_R                                        = 0x10B0,
+	CL_A                                        = 0x10B1,
+	CL_RG                                       = 0x10B2,
+	CL_RA                                       = 0x10B3,
+	CL_RGB                                      = 0x10B4,
+	CL_RGBA                                     = 0x10B5,
+	CL_BGRA                                     = 0x10B6,
+	CL_ARGB                                     = 0x10B7,
+	CL_INTENSITY                                = 0x10B8,
+	CL_LUMINANCE                                = 0x10B9,
+
+	// cl_channel_type
+	CL_SNORM_INT8                               = 0x10D0,
+	CL_SNORM_INT16                              = 0x10D1,
+	CL_UNORM_INT8                               = 0x10D2,
+	CL_UNORM_INT16                              = 0x10D3,
+	CL_UNORM_SHORT_565                          = 0x10D4,
+	CL_UNORM_SHORT_555                          = 0x10D5,
+	CL_UNORM_INT_101010                         = 0x10D6,
+	CL_SIGNED_INT8                              = 0x10D7,
+	CL_SIGNED_INT16                             = 0x10D8,
+	CL_SIGNED_INT32                             = 0x10D9,
+	CL_UNSIGNED_INT8                            = 0x10DA,
+	CL_UNSIGNED_INT16                           = 0x10DB,
+	CL_UNSIGNED_INT32                           = 0x10DC,
+	CL_HALF_FLOAT                               = 0x10DD,
+	CL_FLOAT                                    = 0x10DE,
+
+	// cl_mem_object_type
+	CL_MEM_OBJECT_BUFFER                        = 0x10F0,
+	CL_MEM_OBJECT_IMAGE2D                       = 0x10F1,
+	CL_MEM_OBJECT_IMAGE3D                       = 0x10F2,
+
+	// cl_mem_info
+	CL_MEM_TYPE                                 = 0x1100,
+	CL_MEM_FLAGS                                = 0x1101,
+	CL_MEM_SIZE                                 = 0x1102,
+	CL_MEM_HOST_PTR                             = 0x1103,
+	CL_MEM_MAP_COUNT                            = 0x1104,
+	CL_MEM_REFERENCE_COUNT                      = 0x1105,
+	CL_MEM_CONTEXT                              = 0x1106,
+
+	// cl_image_info
+	CL_IMAGE_FORMAT                             = 0x1110,
+	CL_IMAGE_ELEMENT_SIZE                       = 0x1111,
+	CL_IMAGE_ROW_PITCH                          = 0x1112,
+	CL_IMAGE_SLICE_PITCH                        = 0x1113,
+	CL_IMAGE_WIDTH                              = 0x1114,
+	CL_IMAGE_HEIGHT                             = 0x1115,
+	CL_IMAGE_DEPTH                              = 0x1116,
+
+	// cl_addressing_mode
+	CL_ADDRESS_NONE                             = 0x1130,
+	CL_ADDRESS_CLAMP_TO_EDGE                    = 0x1131,
+	CL_ADDRESS_CLAMP                            = 0x1132,
+	CL_ADDRESS_REPEAT                           = 0x1133,
+
+	// cl_filter_mode
+	CL_FILTER_NEAREST                           = 0x1140,
+	CL_FILTER_LINEAR                            = 0x1141,
+
+	// cl_sampler_info
+	CL_SAMPLER_REFERENCE_COUNT                  = 0x1150,
+	CL_SAMPLER_CONTEXT                          = 0x1151,
+	CL_SAMPLER_NORMALIZED_COORDS                = 0x1152,
+	CL_SAMPLER_ADDRESSING_MODE                  = 0x1153,
+	CL_SAMPLER_FILTER_MODE                      = 0x1154,
+
+	// cl_map_flags - bitfield
+	CL_MAP_READ                                 = (1 << 0),
+	CL_MAP_WRITE                                = (1 << 1),
+
+	// cl_program_info
+	CL_PROGRAM_REFERENCE_COUNT                  = 0x1160,
+	CL_PROGRAM_CONTEXT                          = 0x1161,
+	CL_PROGRAM_NUM_DEVICES                      = 0x1162,
+	CL_PROGRAM_DEVICES                          = 0x1163,
+	CL_PROGRAM_SOURCE                           = 0x1164,
+	CL_PROGRAM_BINARY_SIZES                     = 0x1165,
+	CL_PROGRAM_BINARIES                         = 0x1166,
+
+	// cl_program_build_info
+	CL_PROGRAM_BUILD_STATUS                     = 0x1181,
+	CL_PROGRAM_BUILD_OPTIONS                    = 0x1182,
+	CL_PROGRAM_BUILD_LOG                        = 0x1183,
+
+	// cl_build_status
+	CL_BUILD_SUCCESS                            = 0,
+	CL_BUILD_NONE                               = -1,
+	CL_BUILD_ERROR                              = -2,
+	CL_BUILD_IN_PROGRESS                        = -3,
+
+	// cl_kernel_info
+	CL_KERNEL_FUNCTION_NAME                     = 0x1190,
+	CL_KERNEL_NUM_ARGS                          = 0x1191,
+	CL_KERNEL_REFERENCE_COUNT                   = 0x1192,
+	CL_KERNEL_CONTEXT                           = 0x1193,
+	CL_KERNEL_PROGRAM                           = 0x1194,
+
+	// cl_kernel_work_group_info
+	CL_KERNEL_WORK_GROUP_SIZE                   = 0x11B0,
+	CL_KERNEL_COMPILE_WORK_GROUP_SIZE           = 0x11B1,
+	CL_KERNEL_LOCAL_MEM_SIZE                    = 0x11B2,
+
+	// cl_event_info
+	CL_EVENT_COMMAND_QUEUE                      = 0x11D0,
+	CL_EVENT_COMMAND_TYPE                       = 0x11D1,
+	CL_EVENT_REFERENCE_COUNT                    = 0x11D2,
+	CL_EVENT_COMMAND_EXECUTION_STATUS           = 0x11D3,
+
+	// cl_command_type
+	CL_COMMAND_NDRANGE_KERNEL                   = 0x11F0,
+	CL_COMMAND_TASK                             = 0x11F1,
+	CL_COMMAND_NATIVE_KERNEL                    = 0x11F2,
+	CL_COMMAND_READ_BUFFER                      = 0x11F3,
+	CL_COMMAND_WRITE_BUFFER                     = 0x11F4,
+	CL_COMMAND_COPY_BUFFER                      = 0x11F5,
+	CL_COMMAND_READ_IMAGE                       = 0x11F6,
+	CL_COMMAND_WRITE_IMAGE                      = 0x11F7,
+	CL_COMMAND_COPY_IMAGE                       = 0x11F8,
+	CL_COMMAND_COPY_IMAGE_TO_BUFFER             = 0x11F9,
+	CL_COMMAND_COPY_BUFFER_TO_IMAGE             = 0x11FA,
+	CL_COMMAND_MAP_BUFFER                       = 0x11FB,
+	CL_COMMAND_MAP_IMAGE                        = 0x11FC,
+	CL_COMMAND_UNMAP_MEM_OBJECT                 = 0x11FD,
+	CL_COMMAND_MARKER                           = 0x11FE,
+	CL_COMMAND_ACQUIRE_GL_OBJECTS               = 0x11FF,
+	CL_COMMAND_RELEASE_GL_OBJECTS               = 0x1200,
+
+	// command execution status
+	CL_COMPLETE                                 = 0x0,
+	CL_RUNNING                                  = 0x1,
+	CL_SUBMITTED                                = 0x2,
+	CL_QUEUED                                   = 0x3,
+  
+	// cl_profiling_info
+	CL_PROFILING_COMMAND_QUEUED                 = 0x1280,
+	CL_PROFILING_COMMAND_SUBMIT                 = 0x1281,
+	CL_PROFILING_COMMAND_START                  = 0x1282,
+	CL_PROFILING_COMMAND_END                    = 0x1283
+}
+
+/********************************************************************************************************/
+
+// Platform API
+cl_int clGetPlatformIDs(
+	cl_uint          num_entries,
+	cl_platform_id*  platforms,
+	cl_uint*         num_platforms
+);
+
+cl_int clGetPlatformInfo(
+	cl_platform_id    platform,
+	cl_platform_info  param_name,
+	size_t            param_value_size, 
+	void*             param_value,
+	size_t*           param_value_size_ret
+);
+
+// Device APIs
+cl_int clGetDeviceIDs(
+	cl_platform_id    platform,
+	cl_device_type    device_type, 
+	cl_uint           num_entries, 
+	cl_device_id*     devices, 
+	cl_uint*          num_devices
+);
+
+cl_int clGetDeviceInfo(
+	cl_device_id     device,
+	cl_device_info   param_name, 
+	size_t           param_value_size, 
+	void*            param_value,
+	size_t*          param_value_size_ret
+);
+
+// Context APIs
+
+typedef void function(
+	const(char)*,
+	const(void)*,
+	size_t,
+	const(void)*
+) cl_logging_fn;
+ 
+cl_context clCreateContext(
+	const(cl_context_properties)*    properties,
+	cl_uint                          num_devices,
+	const(cl_device_id)*             devices,
+	cl_logging_fn                    pfn_notify,
+	void*                            user_data,
+	cl_int*                          errcode_ret
+);
+
+cl_context clCreateContextFromType(
+	const(cl_context_properties)*    properties,
+	cl_device_type                   device_type,
+	cl_logging_fn                    pfn_notify,
+	void*                            user_data,
+	cl_int*                          errcode_ret
+);
+
+cl_int clRetainContext(
+	cl_context  context
+);
+
+cl_int clReleaseContext(
+	cl_context  context
+);
+
+cl_int clGetContextInfo(
+	cl_context          context, 
+	cl_context_info     param_name, 
+	size_t              param_value_size, 
+	void*               param_value, 
+	size_t*             param_value_size_ret
+);
+
+// Command Queue APIs
+cl_command_queue clCreateCommandQueue(
+	cl_context                      context, 
+	cl_device_id                    device, 
+	cl_command_queue_properties     properties,
+	cl_int*                         errcode_ret
+);
+
+cl_int clRetainCommandQueue(
+	cl_command_queue  command_queue
+);
+
+cl_int clReleaseCommandQueue(
+	cl_command_queue  command_queue
+);
+
+cl_int clGetCommandQueueInfo(
+	cl_command_queue       command_queue,
+	cl_command_queue_info  param_name,
+	size_t                 param_value_size,
+	void *                 param_value,
+	size_t *               param_value_size_ret
+);
+
+cl_int clSetCommandQueueProperty(
+	cl_command_queue               command_queue,
+	cl_command_queue_properties    properties, 
+	cl_bool                        enable,
+	cl_command_queue_properties*   old_properties
+);
+
+// Memory Object APIs
+cl_mem clCreateBuffer(
+	cl_context    context,
+	cl_mem_flags  flags,
+	size_t        size,
+	void *        host_ptr,
+	cl_int *      errcode_ret
+);
+
+cl_mem clCreateImage2D(
+	cl_context               context,
+	cl_mem_flags             flags,
+	const(cl_image_format)*  image_format,
+	size_t                   image_width,
+	size_t                   image_height,
+	size_t                   image_row_pitch, 
+	void*                    host_ptr,
+	cl_int*                  errcode_ret
+);
+
+cl_mem clCreateImage3D(
+	cl_context               context,
+	cl_mem_flags             flags,
+	const(cl_image_format)*  image_format,
+	size_t                   image_width, 
+	size_t                   image_height,
+	size_t                   image_depth, 
+	size_t                   image_row_pitch, 
+	size_t                   image_slice_pitch, 
+	void*                    host_ptr,
+	cl_int*                  errcode_ret
+);
+
+cl_int clRetainMemObject(
+	cl_mem  memobj
+);
+
+cl_int clReleaseMemObject(
+	cl_mem  memobj
+);
+
+cl_int clGetSupportedImageFormats(
+	cl_context            context,
+	cl_mem_flags          flags,
+	cl_mem_object_type    image_type,
+	cl_uint               num_entries,
+	cl_image_format*      image_formats,
+	cl_uint*              num_image_formats
+);
+
+cl_int clGetMemObjectInfo(
+	cl_mem            memobj,
+	cl_mem_info       param_name, 
+	size_t            param_value_size,
+	void*             param_value,
+	size_t*           param_value_size_ret
+);
+
+cl_int clGetImageInfo(
+	cl_mem            image,
+	cl_image_info     param_name, 
+	size_t            param_value_size,
+	void *            param_value,
+	size_t *          param_value_size_ret
+);
+
+// Sampler APIs
+cl_sampler clCreateSampler(
+	cl_context           context,
+	cl_bool              normalized_coords, 
+	cl_addressing_mode   addressing_mode, 
+	cl_filter_mode       filter_mode,
+	cl_int*              errcode_ret
+);
+
+cl_int clRetainSampler(
+	cl_sampler  sampler
+);
+
+cl_int clReleaseSampler(
+	cl_sampler  sampler
+);
+
+cl_int clGetSamplerInfo(
+	cl_sampler          sampler,
+	cl_sampler_info     param_name,
+	size_t              param_value_size,
+	void*               param_value,
+	size_t*             param_value_size_ret
+);
+
+// Program Object APIs
+cl_program clCreateProgramWithSource(
+	cl_context         context,
+	cl_uint            count,
+	const(char*)*      strings,
+	const(size_t)*     lengths,
+	cl_int*            errcode_ret
+);
+
+cl_program clCreateProgramWithBinary(
+	cl_context             context,
+	cl_uint                num_devices,
+	const(cl_device_id)*   device_list,
+	const(size_t)*         lengths,
+	const(ubyte*)*          binaries,
+	cl_int*                binary_status,
+	cl_int*                errcode_ret
+);
+
+cl_int clRetainProgram(
+	cl_program  program
+);
+
+cl_int clReleaseProgram(
+	cl_program  program
+);
+
+cl_int clBuildProgram(
+	cl_program            program,
+	cl_uint               num_devices,
+	const(cl_device_id)*  device_list,
+	const(char)*          options, 
+	void function(
+		cl_program		  program,
+		void*			  user_data
+	) pfn_notify,
+	void*                 user_data
+);
+
+cl_int clUnloadCompiler();
+
+cl_int clGetProgramInfo(
+	cl_program          program,
+	cl_program_info     param_name,
+	size_t              param_value_size,
+	void*               param_value,
+	size_t*             param_value_size_ret
+);
+
+cl_int clGetProgramBuildInfo(
+	cl_program             program,
+	cl_device_id           device,
+	cl_program_build_info  param_name,
+	size_t                 param_value_size,
+	void*                  param_value,
+	size_t*                param_value_size_ret
+);
+
+// Kernel Object APIs
+cl_kernel clCreateKernel(
+	cl_program       program,
+	const(char)*     kernel_name,
+	cl_int*          errcode_ret
+);
+
+cl_int clCreateKernelsInProgram(
+	cl_program      program,
+	cl_uint         num_kernels,
+	cl_kernel*      kernels,
+	cl_uint*        num_kernels_ret
+);
+
+cl_int clRetainKernel(
+	cl_kernel     kernel
+);
+
+cl_int clReleaseKernel(
+	cl_kernel    kernel
+);
+
+cl_int clSetKernelArg(
+	cl_kernel     kernel,
+	cl_uint       arg_indx,
+	size_t        arg_size,
+	const(void)*  arg_value
+);
+
+cl_int clGetKernelInfo(
+	cl_kernel        kernel,
+	cl_kernel_info   param_name,
+	size_t           param_value_size,
+	void*            param_value,
+	size_t*          param_value_size_ret
+);
+
+cl_int clGetKernelWorkGroupInfo(
+	cl_kernel                   kernel,
+	cl_device_id                device,
+	cl_kernel_work_group_info   param_name,
+	size_t                      param_value_size,
+	void*                       param_value,
+	size_t*                     param_value_size_ret
+);
+
+// Event Object APIs
+cl_int clWaitForEvents(
+	cl_uint              num_events,
+	const(cl_event)*     event_list
+);
+
+cl_int clGetEventInfo(
+	cl_event          event,
+	cl_event_info     param_name,
+	size_t            param_value_size,
+	void*             param_value,
+	size_t*           param_value_size_ret
+);
+
+cl_int clRetainEvent(
+	cl_event  event
+);
+
+cl_int clReleaseEvent(
+	cl_event  event
+);
+
+// Profiling APIs
+cl_int clGetEventProfilingInfo(
+	cl_event             event,
+	cl_profiling_info    param_name,
+	size_t               param_value_size,
+	void*                param_value,
+	size_t*              param_value_size_ret
+);
+
+// Flush and Finish APIs
+cl_int clFlush(
+	cl_command_queue  command_queue
+);
+
+cl_int clFinish(
+	cl_command_queue  command_queue
+);
+
+// Enqueued Commands APIs
+cl_int clEnqueueReadBuffer(
+	cl_command_queue     command_queue,
+	cl_mem               buffer,
+	cl_bool              blocking_read,
+	size_t               offset,
+	size_t               cb, 
+	void *               ptr,
+	cl_uint              num_events_in_wait_list,
+	const(cl_event)*     event_wait_list,
+	cl_event*            event
+);
+
+cl_int clEnqueueWriteBuffer(
+	cl_command_queue    command_queue, 
+	cl_mem              buffer, 
+	cl_bool             blocking_write, 
+	size_t              offset, 
+	size_t              cb, 
+	const(void)*        ptr, 
+	cl_uint             num_events_in_wait_list, 
+	const(cl_event)*    event_wait_list, 
+	cl_event*           event
+);
+
+cl_int clEnqueueCopyBuffer(
+	cl_command_queue     command_queue, 
+	cl_mem               src_buffer,
+	cl_mem               dst_buffer, 
+	size_t               src_offset,
+	size_t               dst_offset,
+	size_t               cb, 
+	cl_uint              num_events_in_wait_list,
+	const(cl_event)*     event_wait_list,
+	cl_event*            event
+);
+
+cl_int clEnqueueReadImage(
+	cl_command_queue      command_queue,
+	cl_mem                image,
+	cl_bool               blocking_read, 
+	const(size_t)*        origin[3],
+	const(size_t)*        region[3],
+	size_t                row_pitch,
+	size_t                slice_pitch, 
+	void*                 ptr,
+	cl_uint               num_events_in_wait_list,
+	const(cl_event)*      event_wait_list,
+	cl_event*             event
+);
+
+cl_int clEnqueueWriteImage(
+	cl_command_queue     command_queue,
+	cl_mem               image,
+	cl_bool              blocking_write, 
+	const(size_t)*       origin[3],
+	const(size_t)*       region[3],
+	size_t               input_row_pitch,
+	size_t               input_slice_pitch, 
+	const(void)*         ptr,
+	cl_uint              num_events_in_wait_list,
+	const(cl_event)*     event_wait_list,
+	cl_event*            event
+);
+
+cl_int clEnqueueCopyImage(
+	cl_command_queue      command_queue,
+	cl_mem                src_image,
+	cl_mem                dst_image, 
+	const(size_t)*        src_origin[3],
+	const(size_t)*        dst_origin[3],
+	const(size_t)*        region[3], 
+	cl_uint               num_events_in_wait_list,
+	const(cl_event)*      event_wait_list,
+	cl_event*             event
+);
+
+cl_int clEnqueueCopyImageToBuffer(
+	cl_command_queue  command_queue,
+	cl_mem            src_image,
+	cl_mem            dst_buffer, 
+	const(size_t)*    src_origin[3],
+	const(size_t)*    region[3], 
+	size_t            dst_offset,
+	cl_uint           num_events_in_wait_list,
+	const(cl_event)*  event_wait_list,
+	cl_event*         event
+);
+
+cl_int clEnqueueCopyBufferToImage(
+	cl_command_queue  command_queue,
+	cl_mem            src_buffer,
+	cl_mem            dst_image, 
+	size_t            src_offset,
+	const(size_t)*    dst_origin[3],
+	const(size_t)*    region[3], 
+	cl_uint           num_events_in_wait_list,
+	const(cl_event)*  event_wait_list,
+	cl_event*         event
+);
+
+void* clEnqueueMapBuffer(
+	cl_command_queue  command_queue,
+	cl_mem            buffer,
+	cl_bool           blocking_map, 
+	cl_map_flags      map_flags,
+	size_t            offset,
+	size_t            cb,
+	cl_uint           num_events_in_wait_list,
+	const(cl_event)*  event_wait_list,
+	cl_event*         event,
+	cl_int*           errcode_ret
+);
+
+void* clEnqueueMapImage(
+	cl_command_queue   command_queue,
+	cl_mem             image, 
+	cl_bool            blocking_map, 
+	cl_map_flags       map_flags, 
+	const(size_t)*     origin[3],
+	const(size_t)*     region[3],
+	size_t*            image_row_pitch,
+	size_t*            image_slice_pitch,
+	cl_uint            num_events_in_wait_list,
+	const(cl_event)*   event_wait_list,
+	cl_event*          event,
+	cl_int*            errcode_ret
+);
+
+cl_int clEnqueueUnmapMemObject(
+	cl_command_queue  command_queue,
+	cl_mem            memobj,
+	void*             mapped_ptr,
+	cl_uint           num_events_in_wait_list,
+	const(cl_event)*  event_wait_list,
+	cl_event*         event
+);
+
+cl_int clEnqueueNDRangeKernel(
+	cl_command_queue  command_queue,
+	cl_kernel         kernel,
+	cl_uint           work_dim,
+	const(size_t)*    global_work_offset,
+	const(size_t)*    global_work_size,
+	const(size_t)*    local_work_size,
+	cl_uint           num_events_in_wait_list,
+	const(cl_event)*  event_wait_list,
+	cl_event*         event
+);
+
+cl_int clEnqueueTask(
+	cl_command_queue   command_queue,
+	cl_kernel          kernel,
+	cl_uint            num_events_in_wait_list,
+	const(cl_event)*   event_wait_list,
+	cl_event*          event
+);
+
+cl_int clEnqueueNativeKernel(
+	cl_command_queue   command_queue,
+	void function(
+		void*
+	) user_func, 
+	void*              args,
+	size_t             cb_args, 
+	cl_uint            num_mem_objects,
+	const(cl_mem)*     mem_list,
+	const(void*)*      args_mem_loc,
+	cl_uint            num_events_in_wait_list,
+	const(cl_event)*   event_wait_list,
+	cl_event*          event
+);
+
+cl_int clEnqueueMarker(
+	cl_command_queue     command_queue,
+	cl_event*            event
+);
+
+cl_int clEnqueueWaitForEvents(
+	cl_command_queue  command_queue,
+	cl_uint           num_events,
+	const(cl_event)*  event_list
+);
+
+cl_int clEnqueueBarrier(
+	cl_command_queue  command_queue
+);
+
+//Extension function access
+//
+// Returns the extension function address for the given function name,
+// or NULL if a valid function can not be found.  The client must
+// check to make sure the address is not NULL, before using or 
+// calling the returned function address.
+//
+void* clGetExtensionFunctionAddress(const(char)* func_name);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/orgHeaders/cl.h	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,873 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ ******************************************************************************/
+
+/* $Revision: 9283 $ on $Date: 2009-10-14 10:18:57 -0700 (Wed, 14 Oct 2009) $ */
+
+#ifndef __OPENCL_CL_H
+#define __OPENCL_CL_H
+
+#ifdef __APPLE__
+#include <OpenCL/cl_platform.h>
+#else
+#include <CL/cl_platform.h>
+#endif	
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+
+typedef struct _cl_platform_id *    cl_platform_id;
+typedef struct _cl_device_id *      cl_device_id;
+typedef struct _cl_context *        cl_context;
+typedef struct _cl_command_queue *  cl_command_queue;
+typedef struct _cl_mem *            cl_mem;
+typedef struct _cl_program *        cl_program;
+typedef struct _cl_kernel *         cl_kernel;
+typedef struct _cl_event *          cl_event;
+typedef struct _cl_sampler *        cl_sampler;
+
+typedef cl_uint             cl_bool;                     /* WARNING!  Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ 
+typedef cl_ulong            cl_bitfield;
+typedef cl_bitfield         cl_device_type;
+typedef cl_uint             cl_platform_info;
+typedef cl_uint             cl_device_info;
+typedef cl_bitfield         cl_device_address_info;
+typedef cl_bitfield         cl_device_fp_config;
+typedef cl_uint             cl_device_mem_cache_type;
+typedef cl_uint             cl_device_local_mem_type;
+typedef cl_bitfield         cl_device_exec_capabilities;
+typedef cl_bitfield         cl_command_queue_properties;
+
+typedef intptr_t			cl_context_properties;
+typedef cl_uint             cl_context_info;
+typedef cl_uint             cl_command_queue_info;
+typedef cl_uint             cl_channel_order;
+typedef cl_uint             cl_channel_type;
+typedef cl_bitfield         cl_mem_flags;
+typedef cl_uint             cl_mem_object_type;
+typedef cl_uint             cl_mem_info;
+typedef cl_uint             cl_image_info;
+typedef cl_uint             cl_addressing_mode;
+typedef cl_uint             cl_filter_mode;
+typedef cl_uint             cl_sampler_info;
+typedef cl_bitfield         cl_map_flags;
+typedef cl_uint             cl_program_info;
+typedef cl_uint             cl_program_build_info;
+typedef cl_int              cl_build_status;
+typedef cl_uint             cl_kernel_info;
+typedef cl_uint             cl_kernel_work_group_info;
+typedef cl_uint             cl_event_info;
+typedef cl_uint             cl_command_type;
+typedef cl_uint             cl_profiling_info;
+
+typedef struct _cl_image_format {
+    cl_channel_order        image_channel_order;
+    cl_channel_type         image_channel_data_type;
+} cl_image_format;
+
+
+
+/******************************************************************************/
+
+// Error Codes
+#define CL_SUCCESS                                  0
+#define CL_DEVICE_NOT_FOUND                         -1
+#define CL_DEVICE_NOT_AVAILABLE                     -2
+#define CL_COMPILER_NOT_AVAILABLE                   -3
+#define CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
+#define CL_OUT_OF_RESOURCES                         -5
+#define CL_OUT_OF_HOST_MEMORY                       -6
+#define CL_PROFILING_INFO_NOT_AVAILABLE             -7
+#define CL_MEM_COPY_OVERLAP                         -8
+#define CL_IMAGE_FORMAT_MISMATCH                    -9
+#define CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
+#define CL_BUILD_PROGRAM_FAILURE                    -11
+#define CL_MAP_FAILURE                              -12
+
+#define CL_INVALID_VALUE                            -30
+#define CL_INVALID_DEVICE_TYPE                      -31
+#define CL_INVALID_PLATFORM                         -32
+#define CL_INVALID_DEVICE                           -33
+#define CL_INVALID_CONTEXT                          -34
+#define CL_INVALID_QUEUE_PROPERTIES                 -35
+#define CL_INVALID_COMMAND_QUEUE                    -36
+#define CL_INVALID_HOST_PTR                         -37
+#define CL_INVALID_MEM_OBJECT                       -38
+#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
+#define CL_INVALID_IMAGE_SIZE                       -40
+#define CL_INVALID_SAMPLER                          -41
+#define CL_INVALID_BINARY                           -42
+#define CL_INVALID_BUILD_OPTIONS                    -43
+#define CL_INVALID_PROGRAM                          -44
+#define CL_INVALID_PROGRAM_EXECUTABLE               -45
+#define CL_INVALID_KERNEL_NAME                      -46
+#define CL_INVALID_KERNEL_DEFINITION                -47
+#define CL_INVALID_KERNEL                           -48
+#define CL_INVALID_ARG_INDEX                        -49
+#define CL_INVALID_ARG_VALUE                        -50
+#define CL_INVALID_ARG_SIZE                         -51
+#define CL_INVALID_KERNEL_ARGS                      -52
+#define CL_INVALID_WORK_DIMENSION                   -53
+#define CL_INVALID_WORK_GROUP_SIZE                  -54
+#define CL_INVALID_WORK_ITEM_SIZE                   -55
+#define CL_INVALID_GLOBAL_OFFSET                    -56
+#define CL_INVALID_EVENT_WAIT_LIST                  -57
+#define CL_INVALID_EVENT                            -58
+#define CL_INVALID_OPERATION                        -59
+#define CL_INVALID_GL_OBJECT                        -60
+#define CL_INVALID_BUFFER_SIZE                      -61
+#define CL_INVALID_MIP_LEVEL                        -62
+#define CL_INVALID_GLOBAL_WORK_SIZE                 -63
+
+// OpenCL Version
+#define CL_VERSION_1_0                              1
+
+// cl_bool
+#define CL_FALSE                                    0
+#define CL_TRUE                                     1
+
+// cl_platform_info
+#define CL_PLATFORM_PROFILE                         0x0900
+#define CL_PLATFORM_VERSION                         0x0901
+#define CL_PLATFORM_NAME                            0x0902
+#define CL_PLATFORM_VENDOR                          0x0903
+#define CL_PLATFORM_EXTENSIONS                      0x0904
+
+// cl_device_type - bitfield
+#define CL_DEVICE_TYPE_DEFAULT                      (1 << 0)
+#define CL_DEVICE_TYPE_CPU                          (1 << 1)
+#define CL_DEVICE_TYPE_GPU                          (1 << 2)
+#define CL_DEVICE_TYPE_ACCELERATOR                  (1 << 3)
+#define CL_DEVICE_TYPE_ALL                          0xFFFFFFFF
+
+// cl_device_info
+#define CL_DEVICE_TYPE                              0x1000
+#define CL_DEVICE_VENDOR_ID                         0x1001
+#define CL_DEVICE_MAX_COMPUTE_UNITS                 0x1002
+#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          0x1003
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE               0x1004
+#define CL_DEVICE_MAX_WORK_ITEM_SIZES               0x1005
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       0x1006
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      0x1007
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        0x1008
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       0x1009
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      0x100A
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     0x100B
+#define CL_DEVICE_MAX_CLOCK_FREQUENCY               0x100C
+#define CL_DEVICE_ADDRESS_BITS                      0x100D
+#define CL_DEVICE_MAX_READ_IMAGE_ARGS               0x100E
+#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS              0x100F
+#define CL_DEVICE_MAX_MEM_ALLOC_SIZE                0x1010
+#define CL_DEVICE_IMAGE2D_MAX_WIDTH                 0x1011
+#define CL_DEVICE_IMAGE2D_MAX_HEIGHT                0x1012
+#define CL_DEVICE_IMAGE3D_MAX_WIDTH                 0x1013
+#define CL_DEVICE_IMAGE3D_MAX_HEIGHT                0x1014
+#define CL_DEVICE_IMAGE3D_MAX_DEPTH                 0x1015
+#define CL_DEVICE_IMAGE_SUPPORT                     0x1016
+#define CL_DEVICE_MAX_PARAMETER_SIZE                0x1017
+#define CL_DEVICE_MAX_SAMPLERS                      0x1018
+#define CL_DEVICE_MEM_BASE_ADDR_ALIGN               0x1019
+#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          0x101A
+#define CL_DEVICE_SINGLE_FP_CONFIG                  0x101B
+#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             0x101C
+#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         0x101D
+#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             0x101E
+#define CL_DEVICE_GLOBAL_MEM_SIZE                   0x101F
+#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          0x1020
+#define CL_DEVICE_MAX_CONSTANT_ARGS                 0x1021
+#define CL_DEVICE_LOCAL_MEM_TYPE                    0x1022
+#define CL_DEVICE_LOCAL_MEM_SIZE                    0x1023
+#define CL_DEVICE_ERROR_CORRECTION_SUPPORT          0x1024
+#define CL_DEVICE_PROFILING_TIMER_RESOLUTION        0x1025
+#define CL_DEVICE_ENDIAN_LITTLE                     0x1026
+#define CL_DEVICE_AVAILABLE                         0x1027
+#define CL_DEVICE_COMPILER_AVAILABLE                0x1028
+#define CL_DEVICE_EXECUTION_CAPABILITIES            0x1029
+#define CL_DEVICE_QUEUE_PROPERTIES                  0x102A
+#define CL_DEVICE_NAME                              0x102B
+#define CL_DEVICE_VENDOR                            0x102C
+#define CL_DRIVER_VERSION                           0x102D
+#define CL_DEVICE_PROFILE                           0x102E
+#define CL_DEVICE_VERSION                           0x102F
+#define CL_DEVICE_EXTENSIONS                        0x1030
+#define CL_DEVICE_PLATFORM                          0x1031
+	
+// cl_device_fp_config - bitfield
+#define CL_FP_DENORM                                (1 << 0)
+#define CL_FP_INF_NAN                               (1 << 1)
+#define CL_FP_ROUND_TO_NEAREST                      (1 << 2)
+#define CL_FP_ROUND_TO_ZERO                         (1 << 3)
+#define CL_FP_ROUND_TO_INF                          (1 << 4)
+#define CL_FP_FMA                                   (1 << 5)
+
+// cl_device_mem_cache_type
+#define CL_NONE                                     0x0
+#define CL_READ_ONLY_CACHE                          0x1
+#define CL_READ_WRITE_CACHE                         0x2
+
+// cl_device_local_mem_type
+#define CL_LOCAL                                    0x1
+#define CL_GLOBAL                                   0x2
+
+// cl_device_exec_capabilities - bitfield
+#define CL_EXEC_KERNEL                              (1 << 0)
+#define CL_EXEC_NATIVE_KERNEL                       (1 << 1)
+
+// cl_command_queue_properties - bitfield
+#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      (1 << 0)
+#define CL_QUEUE_PROFILING_ENABLE                   (1 << 1)
+
+// cl_context_info
+#define CL_CONTEXT_REFERENCE_COUNT                  0x1080
+#define CL_CONTEXT_DEVICES                          0x1081
+#define CL_CONTEXT_PROPERTIES                       0x1082
+
+// cl_context_properties
+#define CL_CONTEXT_PLATFORM                         0x1084
+
+// cl_command_queue_info
+#define CL_QUEUE_CONTEXT                            0x1090
+#define CL_QUEUE_DEVICE                             0x1091
+#define CL_QUEUE_REFERENCE_COUNT                    0x1092
+#define CL_QUEUE_PROPERTIES                         0x1093
+
+// cl_mem_flags - bitfield
+#define CL_MEM_READ_WRITE                           (1 << 0)
+#define CL_MEM_WRITE_ONLY                           (1 << 1)
+#define CL_MEM_READ_ONLY                            (1 << 2)
+#define CL_MEM_USE_HOST_PTR                         (1 << 3)
+#define CL_MEM_ALLOC_HOST_PTR                       (1 << 4)
+#define CL_MEM_COPY_HOST_PTR                        (1 << 5)
+
+// cl_channel_order
+#define CL_R                                        0x10B0
+#define CL_A                                        0x10B1
+#define CL_RG                                       0x10B2
+#define CL_RA                                       0x10B3
+#define CL_RGB                                      0x10B4
+#define CL_RGBA                                     0x10B5
+#define CL_BGRA                                     0x10B6
+#define CL_ARGB                                     0x10B7
+#define CL_INTENSITY                                0x10B8
+#define CL_LUMINANCE                                0x10B9
+
+// cl_channel_type
+#define CL_SNORM_INT8                               0x10D0
+#define CL_SNORM_INT16                              0x10D1
+#define CL_UNORM_INT8                               0x10D2
+#define CL_UNORM_INT16                              0x10D3
+#define CL_UNORM_SHORT_565                          0x10D4
+#define CL_UNORM_SHORT_555                          0x10D5
+#define CL_UNORM_INT_101010                         0x10D6
+#define CL_SIGNED_INT8                              0x10D7
+#define CL_SIGNED_INT16                             0x10D8
+#define CL_SIGNED_INT32                             0x10D9
+#define CL_UNSIGNED_INT8                            0x10DA
+#define CL_UNSIGNED_INT16                           0x10DB
+#define CL_UNSIGNED_INT32                           0x10DC
+#define CL_HALF_FLOAT                               0x10DD
+#define CL_FLOAT                                    0x10DE
+
+// cl_mem_object_type
+#define CL_MEM_OBJECT_BUFFER                        0x10F0
+#define CL_MEM_OBJECT_IMAGE2D                       0x10F1
+#define CL_MEM_OBJECT_IMAGE3D                       0x10F2
+
+// cl_mem_info
+#define CL_MEM_TYPE                                 0x1100
+#define CL_MEM_FLAGS                                0x1101
+#define CL_MEM_SIZE                                 0x1102
+#define CL_MEM_HOST_PTR                             0x1103
+#define CL_MEM_MAP_COUNT                            0x1104
+#define CL_MEM_REFERENCE_COUNT                      0x1105
+#define CL_MEM_CONTEXT                              0x1106
+
+// cl_image_info
+#define CL_IMAGE_FORMAT                             0x1110
+#define CL_IMAGE_ELEMENT_SIZE                       0x1111
+#define CL_IMAGE_ROW_PITCH                          0x1112
+#define CL_IMAGE_SLICE_PITCH                        0x1113
+#define CL_IMAGE_WIDTH                              0x1114
+#define CL_IMAGE_HEIGHT                             0x1115
+#define CL_IMAGE_DEPTH                              0x1116
+
+// cl_addressing_mode
+#define CL_ADDRESS_NONE                             0x1130
+#define CL_ADDRESS_CLAMP_TO_EDGE                    0x1131
+#define CL_ADDRESS_CLAMP                            0x1132
+#define CL_ADDRESS_REPEAT                           0x1133
+
+// cl_filter_mode
+#define CL_FILTER_NEAREST                           0x1140
+#define CL_FILTER_LINEAR                            0x1141
+
+// cl_sampler_info
+#define CL_SAMPLER_REFERENCE_COUNT                  0x1150
+#define CL_SAMPLER_CONTEXT                          0x1151
+#define CL_SAMPLER_NORMALIZED_COORDS                0x1152
+#define CL_SAMPLER_ADDRESSING_MODE                  0x1153
+#define CL_SAMPLER_FILTER_MODE                      0x1154
+
+// cl_map_flags - bitfield
+#define CL_MAP_READ                                 (1 << 0)
+#define CL_MAP_WRITE                                (1 << 1)
+
+// cl_program_info
+#define CL_PROGRAM_REFERENCE_COUNT                  0x1160
+#define CL_PROGRAM_CONTEXT                          0x1161
+#define CL_PROGRAM_NUM_DEVICES                      0x1162
+#define CL_PROGRAM_DEVICES                          0x1163
+#define CL_PROGRAM_SOURCE                           0x1164
+#define CL_PROGRAM_BINARY_SIZES                     0x1165
+#define CL_PROGRAM_BINARIES                         0x1166
+
+// cl_program_build_info
+#define CL_PROGRAM_BUILD_STATUS                     0x1181
+#define CL_PROGRAM_BUILD_OPTIONS                    0x1182
+#define CL_PROGRAM_BUILD_LOG                        0x1183
+
+// cl_build_status
+#define CL_BUILD_SUCCESS                            0
+#define CL_BUILD_NONE                               -1
+#define CL_BUILD_ERROR                              -2
+#define CL_BUILD_IN_PROGRESS                        -3
+
+// cl_kernel_info
+#define CL_KERNEL_FUNCTION_NAME                     0x1190
+#define CL_KERNEL_NUM_ARGS                          0x1191
+#define CL_KERNEL_REFERENCE_COUNT                   0x1192
+#define CL_KERNEL_CONTEXT                           0x1193
+#define CL_KERNEL_PROGRAM                           0x1194
+
+// cl_kernel_work_group_info
+#define CL_KERNEL_WORK_GROUP_SIZE                   0x11B0
+#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE           0x11B1
+#define CL_KERNEL_LOCAL_MEM_SIZE                    0x11B2
+
+// cl_event_info
+#define CL_EVENT_COMMAND_QUEUE                      0x11D0
+#define CL_EVENT_COMMAND_TYPE                       0x11D1
+#define CL_EVENT_REFERENCE_COUNT                    0x11D2
+#define CL_EVENT_COMMAND_EXECUTION_STATUS           0x11D3
+
+// cl_command_type
+#define CL_COMMAND_NDRANGE_KERNEL                   0x11F0
+#define CL_COMMAND_TASK                             0x11F1
+#define CL_COMMAND_NATIVE_KERNEL                    0x11F2
+#define CL_COMMAND_READ_BUFFER                      0x11F3
+#define CL_COMMAND_WRITE_BUFFER                     0x11F4
+#define CL_COMMAND_COPY_BUFFER                      0x11F5
+#define CL_COMMAND_READ_IMAGE                       0x11F6
+#define CL_COMMAND_WRITE_IMAGE                      0x11F7
+#define CL_COMMAND_COPY_IMAGE                       0x11F8
+#define CL_COMMAND_COPY_IMAGE_TO_BUFFER             0x11F9
+#define CL_COMMAND_COPY_BUFFER_TO_IMAGE             0x11FA
+#define CL_COMMAND_MAP_BUFFER                       0x11FB
+#define CL_COMMAND_MAP_IMAGE                        0x11FC
+#define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
+#define CL_COMMAND_MARKER                           0x11FE
+#define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x11FF
+#define CL_COMMAND_RELEASE_GL_OBJECTS               0x1200
+
+// command execution status
+#define CL_COMPLETE                                 0x0
+#define CL_RUNNING                                  0x1
+#define CL_SUBMITTED                                0x2
+#define CL_QUEUED                                   0x3
+  
+// cl_profiling_info
+#define CL_PROFILING_COMMAND_QUEUED                 0x1280
+#define CL_PROFILING_COMMAND_SUBMIT                 0x1281
+#define CL_PROFILING_COMMAND_START                  0x1282
+#define CL_PROFILING_COMMAND_END                    0x1283
+
+/********************************************************************************************************/
+
+// Platform API
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPlatformIDs(cl_uint          /* num_entries */,
+                 cl_platform_id * /* platforms */,
+                 cl_uint *        /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL 
+clGetPlatformInfo(cl_platform_id   /* platform */, 
+                  cl_platform_info /* param_name */,
+                  size_t           /* param_value_size */, 
+                  void *           /* param_value */,
+                  size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Device APIs
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDs(cl_platform_id   /* platform */,
+               cl_device_type   /* device_type */, 
+               cl_uint          /* num_entries */, 
+               cl_device_id *   /* devices */, 
+               cl_uint *        /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceInfo(cl_device_id    /* device */,
+                cl_device_info  /* param_name */, 
+                size_t          /* param_value_size */, 
+                void *          /* param_value */,
+                size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Context APIs  
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContext(const cl_context_properties * /* properties */,
+                cl_uint                       /* num_devices */,
+                const cl_device_id *          /* devices */,
+                void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
+                void *                        /* user_data */,
+                cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContextFromType(const cl_context_properties * /* properties */,
+                        cl_device_type                /* device_type */,
+                        void (*pfn_notify)(const char *, const void *, size_t, void *) /* pfn_notify */,
+                        void *                        /* user_data */,
+                        cl_int *                      /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetContextInfo(cl_context         /* context */, 
+                 cl_context_info    /* param_name */, 
+                 size_t             /* param_value_size */, 
+                 void *             /* param_value */, 
+                 size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Command Queue APIs
+extern CL_API_ENTRY cl_command_queue CL_API_CALL
+clCreateCommandQueue(cl_context                     /* context */, 
+                     cl_device_id                   /* device */, 
+                     cl_command_queue_properties    /* properties */,
+                     cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetCommandQueueInfo(cl_command_queue      /* command_queue */,
+                      cl_command_queue_info /* param_name */,
+                      size_t                /* param_value_size */,
+                      void *                /* param_value */,
+                      size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetCommandQueueProperty(cl_command_queue              /* command_queue */,
+                          cl_command_queue_properties   /* properties */, 
+                          cl_bool                        /* enable */,
+                          cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0;
+
+// Memory Object APIs
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBuffer(cl_context   /* context */,
+               cl_mem_flags /* flags */,
+               size_t       /* size */,
+               void *       /* host_ptr */,
+               cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImage2D(cl_context              /* context */,
+                cl_mem_flags            /* flags */,
+                const cl_image_format * /* image_format */,
+                size_t                  /* image_width */,
+                size_t                  /* image_height */,
+                size_t                  /* image_row_pitch */, 
+                void *                  /* host_ptr */,
+                cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+                        
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImage3D(cl_context              /* context */,
+                cl_mem_flags            /* flags */,
+                const cl_image_format * /* image_format */,
+                size_t                  /* image_width */, 
+                size_t                  /* image_height */,
+                size_t                  /* image_depth */, 
+                size_t                  /* image_row_pitch */, 
+                size_t                  /* image_slice_pitch */, 
+                void *                  /* host_ptr */,
+                cl_int *                /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+                        
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedImageFormats(cl_context           /* context */,
+                           cl_mem_flags         /* flags */,
+                           cl_mem_object_type   /* image_type */,
+                           cl_uint              /* num_entries */,
+                           cl_image_format *    /* image_formats */,
+                           cl_uint *            /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
+                                    
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMemObjectInfo(cl_mem           /* memobj */,
+                   cl_mem_info      /* param_name */, 
+                   size_t           /* param_value_size */,
+                   void *           /* param_value */,
+                   size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetImageInfo(cl_mem           /* image */,
+               cl_image_info    /* param_name */, 
+               size_t           /* param_value_size */,
+               void *           /* param_value */,
+               size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Sampler APIs
+extern CL_API_ENTRY cl_sampler CL_API_CALL
+clCreateSampler(cl_context          /* context */,
+                cl_bool             /* normalized_coords */, 
+                cl_addressing_mode  /* addressing_mode */, 
+                cl_filter_mode      /* filter_mode */,
+                cl_int *            /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSamplerInfo(cl_sampler         /* sampler */,
+                 cl_sampler_info    /* param_name */,
+                 size_t             /* param_value_size */,
+                 void *             /* param_value */,
+                 size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+                            
+// Program Object APIs
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithSource(cl_context        /* context */,
+                          cl_uint           /* count */,
+                          const char **     /* strings */,
+                          const size_t *    /* lengths */,
+                          cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithBinary(cl_context                     /* context */,
+                          cl_uint                        /* num_devices */,
+                          const cl_device_id *           /* device_list */,
+                          const size_t *                 /* lengths */,
+                          const unsigned char **         /* binaries */,
+                          cl_int *                       /* binary_status */,
+                          cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clBuildProgram(cl_program           /* program */,
+               cl_uint              /* num_devices */,
+               const cl_device_id * /* device_list */,
+               const char *         /* options */, 
+               void (*pfn_notify)(cl_program /* program */, void * /* user_data */),
+               void *               /* user_data */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramInfo(cl_program         /* program */,
+                 cl_program_info    /* param_name */,
+                 size_t             /* param_value_size */,
+                 void *             /* param_value */,
+                 size_t *           /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramBuildInfo(cl_program            /* program */,
+                      cl_device_id          /* device */,
+                      cl_program_build_info /* param_name */,
+                      size_t                /* param_value_size */,
+                      void *                /* param_value */,
+                      size_t *              /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+                            
+// Kernel Object APIs
+extern CL_API_ENTRY cl_kernel CL_API_CALL
+clCreateKernel(cl_program      /* program */,
+               const char *    /* kernel_name */,
+               cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateKernelsInProgram(cl_program     /* program */,
+                         cl_uint        /* num_kernels */,
+                         cl_kernel *    /* kernels */,
+                         cl_uint *      /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainKernel(cl_kernel    /* kernel */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseKernel(cl_kernel   /* kernel */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArg(cl_kernel    /* kernel */,
+               cl_uint      /* arg_index */,
+               size_t       /* arg_size */,
+               const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelInfo(cl_kernel       /* kernel */,
+                cl_kernel_info  /* param_name */,
+                size_t          /* param_value_size */,
+                void *          /* param_value */,
+                size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelWorkGroupInfo(cl_kernel                  /* kernel */,
+                         cl_device_id               /* device */,
+                         cl_kernel_work_group_info  /* param_name */,
+                         size_t                     /* param_value_size */,
+                         void *                     /* param_value */,
+                         size_t *                   /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+// Event Object APIs
+extern CL_API_ENTRY cl_int CL_API_CALL
+clWaitForEvents(cl_uint             /* num_events */,
+                const cl_event *    /* event_list */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventInfo(cl_event         /* event */,
+               cl_event_info    /* param_name */,
+               size_t           /* param_value_size */,
+               void *           /* param_value */,
+               size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+                            
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+// Profiling APIs
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventProfilingInfo(cl_event            /* event */,
+                        cl_profiling_info   /* param_name */,
+                        size_t              /* param_value_size */,
+                        void *              /* param_value */,
+                        size_t *            /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+                                
+// Flush and Finish APIs
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+// Enqueued Commands APIs
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadBuffer(cl_command_queue    /* command_queue */,
+                    cl_mem              /* buffer */,
+                    cl_bool             /* blocking_read */,
+                    size_t              /* offset */,
+                    size_t              /* cb */, 
+                    void *              /* ptr */,
+                    cl_uint             /* num_events_in_wait_list */,
+                    const cl_event *    /* event_wait_list */,
+                    cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
+                            
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteBuffer(cl_command_queue   /* command_queue */, 
+                     cl_mem             /* buffer */, 
+                     cl_bool            /* blocking_write */, 
+                     size_t             /* offset */, 
+                     size_t             /* cb */, 
+                     const void *       /* ptr */, 
+                     cl_uint            /* num_events_in_wait_list */, 
+                     const cl_event *   /* event_wait_list */, 
+                     cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_0;
+                            
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBuffer(cl_command_queue    /* command_queue */, 
+                    cl_mem              /* src_buffer */,
+                    cl_mem              /* dst_buffer */, 
+                    size_t              /* src_offset */,
+                    size_t              /* dst_offset */,
+                    size_t              /* cb */, 
+                    cl_uint             /* num_events_in_wait_list */,
+                    const cl_event *    /* event_wait_list */,
+                    cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
+                            
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadImage(cl_command_queue     /* command_queue */,
+                   cl_mem               /* image */,
+                   cl_bool              /* blocking_read */, 
+                   const size_t *       /* origin[3] */,
+                   const size_t *       /* region[3] */,
+                   size_t               /* row_pitch */,
+                   size_t               /* slice_pitch */, 
+                   void *               /* ptr */,
+                   cl_uint              /* num_events_in_wait_list */,
+                   const cl_event *     /* event_wait_list */,
+                   cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteImage(cl_command_queue    /* command_queue */,
+                    cl_mem              /* image */,
+                    cl_bool             /* blocking_write */, 
+                    const size_t *      /* origin[3] */,
+                    const size_t *      /* region[3] */,
+                    size_t              /* input_row_pitch */,
+                    size_t              /* input_slice_pitch */, 
+                    const void *        /* ptr */,
+                    cl_uint             /* num_events_in_wait_list */,
+                    const cl_event *    /* event_wait_list */,
+                    cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImage(cl_command_queue     /* command_queue */,
+                   cl_mem               /* src_image */,
+                   cl_mem               /* dst_image */, 
+                   const size_t *       /* src_origin[3] */,
+                   const size_t *       /* dst_origin[3] */,
+                   const size_t *       /* region[3] */, 
+                   cl_uint              /* num_events_in_wait_list */,
+                   const cl_event *     /* event_wait_list */,
+                   cl_event *           /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
+                           cl_mem           /* src_image */,
+                           cl_mem           /* dst_buffer */, 
+                           const size_t *   /* src_origin[3] */,
+                           const size_t *   /* region[3] */, 
+                           size_t           /* dst_offset */,
+                           cl_uint          /* num_events_in_wait_list */,
+                           const cl_event * /* event_wait_list */,
+                           cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
+                           cl_mem           /* src_buffer */,
+                           cl_mem           /* dst_image */, 
+                           size_t           /* src_offset */,
+                           const size_t *   /* dst_origin[3] */,
+                           const size_t *   /* region[3] */, 
+                           cl_uint          /* num_events_in_wait_list */,
+                           const cl_event * /* event_wait_list */,
+                           cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapBuffer(cl_command_queue /* command_queue */,
+                   cl_mem           /* buffer */,
+                   cl_bool          /* blocking_map */, 
+                   cl_map_flags     /* map_flags */,
+                   size_t           /* offset */,
+                   size_t           /* cb */,
+                   cl_uint          /* num_events_in_wait_list */,
+                   const cl_event * /* event_wait_list */,
+                   cl_event *       /* event */,
+                   cl_int *         /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapImage(cl_command_queue  /* command_queue */,
+                  cl_mem            /* image */, 
+                  cl_bool           /* blocking_map */, 
+                  cl_map_flags      /* map_flags */, 
+                  const size_t *    /* origin[3] */,
+                  const size_t *    /* region[3] */,
+                  size_t *          /* image_row_pitch */,
+                  size_t *          /* image_slice_pitch */,
+                  cl_uint           /* num_events_in_wait_list */,
+                  const cl_event *  /* event_wait_list */,
+                  cl_event *        /* event */,
+                  cl_int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
+                        cl_mem           /* memobj */,
+                        void *           /* mapped_ptr */,
+                        cl_uint          /* num_events_in_wait_list */,
+                        const cl_event *  /* event_wait_list */,
+                        cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
+                       cl_kernel        /* kernel */,
+                       cl_uint          /* work_dim */,
+                       const size_t *   /* global_work_offset */,
+                       const size_t *   /* global_work_size */,
+                       const size_t *   /* local_work_size */,
+                       cl_uint          /* num_events_in_wait_list */,
+                       const cl_event * /* event_wait_list */,
+                       cl_event *       /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueTask(cl_command_queue  /* command_queue */,
+              cl_kernel         /* kernel */,
+              cl_uint           /* num_events_in_wait_list */,
+              const cl_event *  /* event_wait_list */,
+              cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNativeKernel(cl_command_queue  /* command_queue */,
+					  void (*user_func)(void *), 
+                      void *            /* args */,
+                      size_t            /* cb_args */, 
+                      cl_uint           /* num_mem_objects */,
+                      const cl_mem *    /* mem_list */,
+                      const void **     /* args_mem_loc */,
+                      cl_uint           /* num_events_in_wait_list */,
+                      const cl_event *  /* event_wait_list */,
+                      cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMarker(cl_command_queue    /* command_queue */,
+                cl_event *          /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWaitForEvents(cl_command_queue /* command_queue */,
+                       cl_uint          /* num_events */,
+                       const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+// Extension function access
+//
+// Returns the extension function address for the given function name,
+// or NULL if a valid function can not be found.  The client must
+// check to make sure the address is not NULL, before using or 
+// calling the returned function address.
+//
+extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __OPENCL_CL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/orgHeaders/cl_gl.h	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,117 @@
+/**********************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **********************************************************************************/
+
+/* $Revision: 8748 $ on $Date: 2009-08-27 04:24:36 -0700 (Thu, 27 Aug 2009) $ */
+
+#ifndef __OPENCL_CL_GL_H
+#define __OPENCL_CL_GL_H
+
+#ifdef __APPLE__
+#include <OpenCL/cl_platform.h>
+#include <OpenGL/gl.h>
+#else
+#include <CL/cl_platform.h>
+#include <GL/gl.h>
+#endif	
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// NOTE:  Make sure that appropriate GL header file is included separately
+
+typedef cl_uint     cl_gl_object_type;
+typedef cl_uint     cl_gl_texture_info;
+typedef cl_uint     cl_gl_platform_info;
+
+// cl_gl_object_type
+#define CL_GL_OBJECT_BUFFER             0x2000
+#define CL_GL_OBJECT_TEXTURE2D          0x2001
+#define CL_GL_OBJECT_TEXTURE3D          0x2002
+#define CL_GL_OBJECT_RENDERBUFFER       0x2003
+
+// cl_gl_texture_info
+#define CL_GL_TEXTURE_TARGET            0x2004
+#define CL_GL_MIPMAP_LEVEL              0x2005
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLBuffer(cl_context     /* context */,
+                     cl_mem_flags   /* flags */,
+                     GLuint         /* bufobj */,
+                     int *          /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture2D(cl_context      /* context */,
+                        cl_mem_flags    /* flags */,
+                        GLenum          /* target */,
+                        GLint           /* miplevel */,
+                        GLuint          /* texture */,
+                        cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture3D(cl_context      /* context */,
+                        cl_mem_flags    /* flags */,
+                        GLenum          /* target */,
+                        GLint           /* miplevel */,
+                        GLuint          /* texture */,
+                        cl_int *        /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer(cl_context   /* context */,
+                           cl_mem_flags /* flags */,
+                           GLuint       /* renderbuffer */,
+                           cl_int *     /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLObjectInfo(cl_mem                /* memobj */,
+                  cl_gl_object_type *   /* gl_object_type */,
+                  GLuint *              /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
+                  
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLTextureInfo(cl_mem               /* memobj */,
+                   cl_gl_texture_info   /* param_name */,
+                   size_t               /* param_value_size */,
+                   void *               /* param_value */,
+                   size_t *             /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGLObjects(cl_command_queue      /* command_queue */,
+                          cl_uint               /* num_objects */,
+                          const cl_mem *        /* mem_objects */,
+                          cl_uint               /* num_events_in_wait_list */,
+                          const cl_event *      /* event_wait_list */,
+                          cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGLObjects(cl_command_queue      /* command_queue */,
+                          cl_uint               /* num_objects */,
+                          const cl_mem *        /* mem_objects */,
+                          cl_uint               /* num_events_in_wait_list */,
+                          const cl_event *      /* event_wait_list */,
+                          cl_event *            /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __OPENCL_CL_GL_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/orgHeaders/cl_platform.h	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,298 @@
+/**********************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **********************************************************************************/
+
+/* $Revision: 9283 $ on $Date: 2009-10-14 10:18:57 -0700 (Wed, 14 Oct 2009) $ */
+
+#ifndef __CL_PLATFORM_H
+#define __CL_PLATFORM_H
+
+#ifdef __APPLE__
+    /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
+    #include <AvailabilityMacros.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CL_API_ENTRY
+#define CL_API_CALL
+#ifdef __APPLE__
+#define CL_API_SUFFIX__VERSION_1_0   AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#define CL_EXTENSION_WEAK_LINK       __attribute__((weak_import))       
+#else
+#define CL_API_SUFFIX__VERSION_1_0
+#define CL_EXTENSION_WEAK_LINK                         
+#endif
+
+#if (defined (WIN32) && (_MSC_VER))
+
+/* scalar types  */
+typedef signed   __int8         cl_char;
+typedef unsigned __int8         cl_uchar;
+typedef signed   __int16        cl_short;
+typedef unsigned __int16        cl_ushort;
+typedef signed   __int32        cl_int;
+typedef unsigned __int32        cl_uint;
+typedef signed   __int64        cl_long;
+typedef unsigned __int64        cl_ulong;
+
+typedef unsigned __int16        cl_half;
+typedef float                   cl_float;
+typedef double                  cl_double;
+
+
+/*
+ * Vector types 
+ *
+ *  Note:   OpenCL requires that all types be naturally aligned. 
+ *          This means that vector types must be naturally aligned.
+ *          For example, a vector of four floats must be aligned to
+ *          a 16 byte boundary (calculated as 4 * the natural 4-byte 
+ *          alignment of the float).  The alignment qualifiers here
+ *          will only function properly if your compiler supports them
+ *          and if you don't actively work to defeat them.  For example,
+ *          in order for a cl_float4 to be 16 byte aligned in a struct,
+ *          the start of the struct must itself be 16-byte aligned. 
+ *
+ *          Maintaining proper alignment is the user's responsibility.
+ */
+typedef signed   __int8          cl_char2[2];
+typedef signed   __int8          cl_char4[4];
+typedef signed   __int8          cl_char8[8];
+typedef signed   __int8          cl_char16[16];
+typedef unsigned __int8         cl_uchar2[2];
+typedef unsigned __int8         cl_uchar4[4];
+typedef unsigned __int8         cl_uchar8[8];
+typedef unsigned __int8         cl_uchar16[16];
+
+typedef signed   __int16         cl_short2[2];
+typedef signed   __int16         cl_short4[4];
+typedef signed   __int16         cl_short8[8];
+typedef signed   __int16         cl_short16[16];
+typedef unsigned __int16        cl_ushort2[2];
+typedef unsigned __int16        cl_ushort4[4];
+typedef unsigned __int16        cl_ushort8[8];
+typedef unsigned __int16        cl_ushort16[16];
+
+typedef signed   __int32         cl_int2[2];
+typedef signed   __int32         cl_int4[4];
+typedef signed   __int32         cl_int8[8];
+typedef signed   __int32         cl_int16[16];
+typedef unsigned __int32        cl_uint2[2];
+typedef unsigned __int32        cl_uint4[4];
+typedef unsigned __int32        cl_uint8[8];
+typedef unsigned __int32        cl_uint16[16];
+
+typedef signed   __int64         cl_long2[2];
+typedef signed   __int64         cl_long4[4];
+typedef signed   __int64         cl_long8[8];
+typedef signed   __int64         cl_long16[16];
+typedef unsigned __int64        cl_ulong2[2];
+typedef unsigned __int64        cl_ulong4[4];
+typedef unsigned __int64        cl_ulong8[8];
+typedef unsigned __int64        cl_ulong16[16];
+
+typedef float           cl_float2[2];
+typedef float           cl_float4[4];
+typedef float           cl_float8[8];
+typedef float           cl_float16[16];
+
+typedef double          cl_double2[2];
+typedef double          cl_double4[4];
+typedef double          cl_double8[8];
+typedef double          cl_double16[16];
+/* There are no vector types for half */
+
+#define CL_CHAR_BIT         8
+#define CL_SCHAR_MAX        127
+#define CL_SCHAR_MIN        (-127-1)
+#define CL_CHAR_MAX         CL_SCHAR_MAX
+#define CL_CHAR_MIN         CL_SCHAR_MIN
+#define CL_UCHAR_MAX        255
+#define CL_SHRT_MAX         32767
+#define CL_SHRT_MIN         (-32767-1)
+#define CL_USHRT_MAX        65535
+#define CL_INT_MAX          2147483647
+#define CL_INT_MIN          (-2147483647-1)
+#define CL_UINT_MAX         0xffffffffU
+#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG          6
+#define CL_FLT_MANT_DIG     24
+#define CL_FLT_MAX_10_EXP   +38
+#define CL_FLT_MAX_EXP      +128
+#define CL_FLT_MIN_10_EXP   -37
+#define CL_FLT_MIN_EXP      -125
+#define CL_FLT_RADIX        2
+#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN          1.175494350822287507969e-38f
+#define CL_FLT_EPSILON      0x1.0p-23f
+
+#define CL_DBL_DIG          15
+#define CL_DBL_MANT_DIG     53
+#define CL_DBL_MAX_10_EXP   +308
+#define CL_DBL_MAX_EXP      +1024
+#define CL_DBL_MIN_10_EXP   -307
+#define CL_DBL_MIN_EXP      -1021
+#define CL_DBL_RADIX        2
+#define CL_DBL_MAX          179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
+#define CL_DBL_MIN          2.225073858507201383090e-308
+#define CL_DBL_EPSILON      2.220446049250313080847e-16
+
+
+#else
+
+#include <stdint.h>
+
+/* scalar types  */
+typedef int8_t          cl_char;
+typedef uint8_t         cl_uchar;
+typedef int16_t         cl_short    __attribute__((aligned(2)));
+typedef uint16_t        cl_ushort   __attribute__((aligned(2)));
+typedef int32_t         cl_int      __attribute__((aligned(4)));
+typedef uint32_t        cl_uint     __attribute__((aligned(4)));
+typedef int64_t         cl_long     __attribute__((aligned(8)));
+typedef uint64_t        cl_ulong    __attribute__((aligned(8)));
+
+typedef uint16_t        cl_half     __attribute__((aligned(2)));
+typedef float           cl_float    __attribute__((aligned(4)));
+typedef double          cl_double   __attribute__((aligned(8)));
+
+/*
+ * Vector types 
+ *
+ *  Note:   OpenCL requires that all types be naturally aligned. 
+ *          This means that vector types must be naturally aligned.
+ *          For example, a vector of four floats must be aligned to
+ *          a 16 byte boundary (calculated as 4 * the natural 4-byte 
+ *          alignment of the float).  The alignment qualifiers here
+ *          will only function properly if your compiler supports them
+ *          and if you don't actively work to defeat them.  For example,
+ *          in order for a cl_float4 to be 16 byte aligned in a struct,
+ *          the start of the struct must itself be 16-byte aligned. 
+ *
+ *          Maintaining proper alignment is the user's responsibility.
+ */
+typedef int8_t          cl_char2[2]     __attribute__((aligned(2)));
+typedef int8_t          cl_char4[4]     __attribute__((aligned(4)));
+typedef int8_t          cl_char8[8]     __attribute__((aligned(8)));
+typedef int8_t          cl_char16[16]   __attribute__((aligned(16)));
+typedef uint8_t         cl_uchar2[2]    __attribute__((aligned(2)));
+typedef uint8_t         cl_uchar4[4]    __attribute__((aligned(4)));
+typedef uint8_t         cl_uchar8[8]    __attribute__((aligned(8)));
+typedef uint8_t         cl_uchar16[16]  __attribute__((aligned(16)));
+
+typedef int16_t         cl_short2[2]     __attribute__((aligned(4)));
+typedef int16_t         cl_short4[4]     __attribute__((aligned(8)));
+typedef int16_t         cl_short8[8]     __attribute__((aligned(16)));
+typedef int16_t         cl_short16[16]   __attribute__((aligned(32)));
+typedef uint16_t        cl_ushort2[2]    __attribute__((aligned(4)));
+typedef uint16_t        cl_ushort4[4]    __attribute__((aligned(8)));
+typedef uint16_t        cl_ushort8[8]    __attribute__((aligned(16)));
+typedef uint16_t        cl_ushort16[16]  __attribute__((aligned(32)));
+
+typedef int32_t         cl_int2[2]      __attribute__((aligned(8)));
+typedef int32_t         cl_int4[4]      __attribute__((aligned(16)));
+typedef int32_t         cl_int8[8]      __attribute__((aligned(32)));
+typedef int32_t         cl_int16[16]    __attribute__((aligned(64)));
+typedef uint32_t        cl_uint2[2]     __attribute__((aligned(8)));
+typedef uint32_t        cl_uint4[4]     __attribute__((aligned(16)));
+typedef uint32_t        cl_uint8[8]     __attribute__((aligned(32)));
+typedef uint32_t        cl_uint16[16]   __attribute__((aligned(64)));
+
+typedef int64_t         cl_long2[2]     __attribute__((aligned(16)));
+typedef int64_t         cl_long4[4]     __attribute__((aligned(32)));
+typedef int64_t         cl_long8[8]     __attribute__((aligned(64)));
+typedef int64_t         cl_long16[16]   __attribute__((aligned(128)));
+typedef uint64_t        cl_ulong2[2]    __attribute__((aligned(16)));
+typedef uint64_t        cl_ulong4[4]    __attribute__((aligned(32)));
+typedef uint64_t        cl_ulong8[8]    __attribute__((aligned(64)));
+typedef uint64_t        cl_ulong16[16]  __attribute__((aligned(128)));
+
+typedef float           cl_float2[2]    __attribute__((aligned(8)));
+typedef float           cl_float4[4]    __attribute__((aligned(16)));
+typedef float           cl_float8[8]    __attribute__((aligned(32)));
+typedef float           cl_float16[16]  __attribute__((aligned(64)));
+
+typedef double          cl_double2[2]   __attribute__((aligned(16)));
+typedef double          cl_double4[4]   __attribute__((aligned(32)));
+typedef double          cl_double8[8]   __attribute__((aligned(64)));
+typedef double          cl_double16[16] __attribute__((aligned(128)));
+
+/* There are no vector types for half */
+
+/******************************************************************************/
+
+// Macro names and corresponding values defined by OpenCL
+
+#define CL_CHAR_BIT         8
+#define CL_SCHAR_MAX        127
+#define CL_SCHAR_MIN        (-127-1)
+#define CL_CHAR_MAX         CL_SCHAR_MAX
+#define CL_CHAR_MIN         CL_SCHAR_MIN
+#define CL_UCHAR_MAX        255
+#define CL_SHRT_MAX         32767
+#define CL_SHRT_MIN         (-32767-1)
+#define CL_USHRT_MAX        65535
+#define CL_INT_MAX          2147483647
+#define CL_INT_MIN          (-2147483647-1)
+#define CL_UINT_MAX         0xffffffffU
+#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG          6
+#define CL_FLT_MANT_DIG     24
+#define CL_FLT_MAX_10_EXP   +38
+#define CL_FLT_MAX_EXP      +128
+#define CL_FLT_MIN_10_EXP   -37
+#define CL_FLT_MIN_EXP      -125
+#define CL_FLT_RADIX        2
+#define CL_FLT_MAX          0x1.fffffep127f
+#define CL_FLT_MIN          0x1.0p-126f
+#define CL_FLT_EPSILON      0x1.0p-23f
+
+#define CL_DBL_DIG          15
+#define CL_DBL_MANT_DIG     53
+#define CL_DBL_MAX_10_EXP   +308
+#define CL_DBL_MAX_EXP      +1024
+#define CL_DBL_MIN_10_EXP   -307
+#define CL_DBL_MIN_EXP      -1021
+#define CL_DBL_RADIX        2
+#define CL_DBL_MAX          0x1.fffffffffffffp1023
+#define CL_DBL_MIN          0x1.0p-1022
+#define CL_DBL_EPSILON      0x1.0p-52
+
+#endif
+
+#include <stddef.h>
+  
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // __CL_PLATFORM_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/c/platform.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,145 @@
+/**********************************************************************************
+ * Copyright (c) 2008-2009 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are 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 Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **********************************************************************************/
+
+// $Revision: 9283 $ on $Date: 2009-10-14 10:18:57 -0700 (Wed, 14 Oct 2009) $
+
+module opencl.c.platform;
+
+/* scalar types  */
+alias byte		cl_char;
+alias ubyte		cl_uchar;
+alias short		cl_short;
+alias ushort	cl_ushort;
+alias int		cl_int;
+alias uint		cl_uint;
+alias long		cl_long;
+alias ulong		cl_ulong;
+
+alias ushort	cl_half;
+alias float		cl_float;
+alias double	cl_double;
+
+/*
+ * Vector types 
+ *
+ *  Note:   OpenCL requires that all types be naturally aligned. 
+ *          This means that vector types must be naturally aligned.
+ *          For example, a vector of four floats must be aligned to
+ *          a 16 byte boundary (calculated as 4 * the natural 4-byte 
+ *          alignment of the float).  The alignment qualifiers here
+ *          will only function properly if your compiler supports them
+ *          and if you don't actively work to defeat them.  For example,
+ *          in order for a cl_float4 to be 16 byte aligned in a struct,
+ *          the start of the struct must itself be 16-byte aligned. 
+ *
+ *          Maintaining proper alignment is the user's responsibility.
+ */
+
+alias byte[2]		cl_char2;
+alias byte[4]		cl_char4;
+alias byte[8]		cl_char8;
+alias byte[16]		cl_char16;
+alias ubyte[2]		cl_uchar2;
+alias ubyte[4]		cl_uchar4;
+alias ubyte[8]		cl_uchar8;
+alias ubyte[16]		cl_uchar16;
+
+alias short[2]		cl_short2;
+alias short[4]		cl_short4;
+alias short[8]		cl_short8;
+alias short[16]		cl_short16;
+alias ushort[2]		cl_ushort2;
+alias ushort[4]		cl_ushort4;
+alias ushort[8]		cl_ushort8;
+alias ushort[16]	cl_ushort16;
+
+alias int[2]		cl_int2;
+alias int[4]		cl_int4;
+alias int[8]		cl_int8;
+alias int[16]		cl_int16;
+alias uint[2]		cl_uint2;
+alias uint[4]		cl_uint4;
+alias uint[8]		cl_uint8;
+alias uint[16]		cl_uint16;
+
+alias long[2]		cl_long2;
+alias long[4]		cl_long4;
+alias long[8]		cl_long8;
+alias long[16]		cl_long16;
+alias ulong[2]		cl_ulong2;
+alias ulong[4]		cl_ulong4;
+alias ulong[8]		cl_ulong8;
+alias ulong[16]		cl_ulong16;
+
+alias float[2]		cl_float2;
+alias float[4]		cl_float4;
+alias float[8]		cl_float8;
+alias float[16]		cl_float16;
+
+alias double[2]		cl_double2;
+alias double[4]		cl_double4;
+alias double[8]		cl_double8;
+alias double[16]	cl_double16;
+
+/* There are no vector types for half */
+
+enum
+{
+CL_CHAR_BIT         = 8,
+CL_SCHAR_MAX        = 127,
+CL_SCHAR_MIN        = (-127-1),
+CL_CHAR_MAX         = CL_SCHAR_MAX,
+CL_CHAR_MIN         = CL_SCHAR_MIN,
+CL_UCHAR_MAX        = 255,
+CL_SHRT_MAX         = 32767,
+CL_SHRT_MIN         = (-32767-1),
+CL_USHRT_MAX        = 65535,
+CL_INT_MAX          = 2147483647,
+CL_INT_MIN          = (-2147483647-1),
+CL_UINT_MAX         = 0xffffffffU,
+CL_LONG_MAX         = 0x7FFFFFFFFFFFFFFFL,
+CL_LONG_MIN         = -0x7FFFFFFFFFFFFFFFL - 1L,
+CL_ULONG_MAX        = 0xFFFFFFFFFFFFFFFFUL,
+
+CL_FLT_DIG          = 6,
+CL_FLT_MANT_DIG     = 24,
+CL_FLT_MAX_10_EXP   = +38,
+CL_FLT_MAX_EXP      = +128,
+CL_FLT_MIN_10_EXP   = -37,
+CL_FLT_MIN_EXP      = -125,
+CL_FLT_RADIX        = 2,
+CL_FLT_MAX          = 0x1.fffffep127f,
+CL_FLT_MIN          = 0x1.0p-126f,
+CL_FLT_EPSILON      = 0x1.0p-23f,
+
+CL_DBL_DIG          = 15,
+CL_DBL_MANT_DIG     = 53,
+CL_DBL_MAX_10_EXP   = +308,
+CL_DBL_MAX_EXP      = +1024,
+CL_DBL_MIN_10_EXP   = -307,
+CL_DBL_MIN_EXP      = -1021,
+CL_DBL_RADIX        = 2,
+CL_DBL_MAX          = 0x1.fffffffffffffp1023,
+CL_DBL_MIN          = 0x1.0p-1022,
+CL_DBL_EPSILON      = 0x1.0p-52
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/context.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,261 @@
+/**
+ * 
+ */
+module opencl.context;
+
+import opencl.c.opencl;
+import opencl.device;
+import opencl.error;
+import opencl.platform;
+import opencl.program;
+import opencl.wrapper;
+
+/**
+ * context class
+ * Contexts are used by the OpenCL runtime for managing objects such as command-queues, memory,
+ * program and kernel objects and for executing kernels on one or more devices specified in the context.
+ */
+class CLContext : CLWrapper!(cl_context, clGetContextInfo)
+{
+private:
+	CLPlatform	_platform;
+	CLDevice[]	_devices;
+
+public:
+	/// creates an OpenCL context with the given devices
+	this(CLDevice[] devices)
+	{
+		cl_int res;
+		
+		// TODO: add platform_id verification and
+		auto deviceIDs = new cl_device_id[devices.length];
+		for(uint i=0; i<devices.length; i++)
+			deviceIDs[i] = devices[i].getObject();
+
+		// TODO: user notification function
+		_object = clCreateContext(null, deviceIDs.length, deviceIDs.ptr, null, null, &res);
+		if(!_object)
+			switch(res)
+			{
+				case CL_INVALID_PLATFORM:
+					throw new CLInvalidPlatformException("no valid platform could be selected for context creation");
+					break;
+				case CL_INVALID_VALUE:
+					throw new CLInvalidValueException("devices array has length 0 or a null pointer");
+					break;
+				case CL_INVALID_DEVICE:
+					throw new CLInvalidDeviceException("devices contains an invalid device or are not associated with the specified platform");
+					break;
+				case CL_DEVICE_NOT_AVAILABLE:
+					throw new CLDeviceNotAvailableException("a device is currently not available even though the device was returned by getDevices");
+					break;
+				case CL_OUT_OF_HOST_MEMORY:
+					throw new CLOutOfHostMemoryException("couldn't allocate resources required by the OpenCL implementation on the host");
+					break;
+				default:
+					throw new CLUnrecognizedException(res);
+			}
+		
+		
+	}
+	
+	/// create a context from all available devices
+	this()
+	{
+		cl_int res;
+		_object = clCreateContextFromType(null, CL_DEVICE_TYPE_ALL, null, null, &res);
+		
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException("no platform could be selected");
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("internal invalid value error");
+				break;
+			case CL_DEVICE_NOT_AVAILABLE:
+				throw new CLDeviceNotAvailableException("no devices currently available");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("no devices were found");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+		}
+	}
+	
+	~this()
+	{
+		release();
+	}
+	
+	/// increments the context reference count
+	CLContext retain()
+	{
+		cl_int res;
+		res = clRetainContext(_object);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidContextException("internal context object is not a valid OpenCL context");
+		
+		return this;
+	}
+	
+	/// decrements the context reference count
+	void release()
+	{
+		cl_int res;
+		res = clReleaseContext(_object);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidContextException("internal context object is not a valid OpenCL context");
+	}
+	
+	CLProgram createProgram(string sourceCode)
+	{
+		return new CLProgram(this, sourceCode);
+	}
+}
+
+/**
+ * a context using all available GPU devices
+ */
+class CLGPUContext : CLContext
+{
+	this()
+	{
+		cl_int res;
+		_object = clCreateContextFromType(null, CL_DEVICE_TYPE_GPU, null, null, &res);
+		
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException("no platform could be selected");
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("internal invalid value error");
+				break;
+			case CL_DEVICE_NOT_AVAILABLE:
+				throw new CLDeviceNotAvailableException("no GPU devices currently available");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("no GPU devices were found");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+		}
+	}
+}
+
+/**
+* a context using all available CPU devices
+*/
+class CLCPUContext : CLContext
+{
+	this()
+	{
+		cl_int res;
+		_object = clCreateContextFromType(null, CL_DEVICE_TYPE_CPU, null, null, &res);
+		
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException("no platform could be selected");
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("internal invalid value error");
+				break;
+			case CL_DEVICE_NOT_AVAILABLE:
+				throw new CLDeviceNotAvailableException("no CPU devices currently available");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("no CPU devices were found");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+		}
+	}
+}
+
+/**
+* a context using all available accelerator devices
+*/
+class CLAccelContext : CLContext
+{
+	this()
+	{
+		cl_int res;
+		_object = clCreateContextFromType(null, CL_DEVICE_TYPE_ACCELERATOR, null, null, &res);
+		
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException("no platform could be selected");
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("internal invalid value error");
+				break;
+			case CL_DEVICE_NOT_AVAILABLE:
+				throw new CLDeviceNotAvailableException("no accelerator devices currently available");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("no accelerator devices were found");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+		}
+	}
+}
+
+/**
+* a context using all available default devices
+*/
+class CLDefaultContext : CLContext
+{
+	this()
+	{
+		cl_int res;
+		_object = clCreateContextFromType(null, CL_DEVICE_TYPE_DEFAULT, null, null, &res);
+		
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException("no platform could be selected");
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("internal invalid value error");
+				break;
+			case CL_DEVICE_NOT_AVAILABLE:
+				throw new CLDeviceNotAvailableException("no devices currently available");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("no devices were found");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/device.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,69 @@
+/**
+ * 
+ */
+module opencl.device;
+
+import opencl.c.opencl;
+import opencl.platform;
+import opencl.wrapper;
+
+/// device class
+class CLDevice : CLWrapper!(cl_device_id, clGetDeviceInfo)
+{
+private:
+	CLPlatform _platform;
+
+public:
+	///
+	this(CLPlatform platform, cl_device_id device)
+	{
+		super(device);
+		_platform = platform;
+	}
+	
+	/// get the associated platform
+	CLPlatform platform() {return _platform;} // TODO: maybe check with GetDeviceInfo if IDs match
+	
+	/// get device name
+	string name() {return getStringInfo(CL_DEVICE_NAME);}
+	
+	/// get device vendor
+	string vendor() {return getStringInfo(CL_DEVICE_VENDOR);}
+	
+	/// get device OpenCL driver version in the form major_number.minor_number
+	string driverVersion() {return getStringInfo(CL_DRIVER_VERSION);}
+	
+	/**
+	 * get OpenCL profile string
+	 * 
+	 * Returns the profile name supported by the device. 
+	 * The profile name returned can be one of the following strings:
+	 *		FULL_PROFILE - if the device supports the OpenCL specification
+	 *		(functionality defined as part of the core specification and does not require 
+	 *		any extensions to be supported). 
+	 * 
+	 *		EMBEDDED_PROFILE - if the device supports the OpenCL embedded profile.
+	 */
+	string profile() {return getStringInfo(CL_DEVICE_PROFILE);}
+	
+	/**
+	 * get OpenCL version string
+	 * 
+	 * Returns:
+	 *		OpenCL version supported by the device.
+	 *		This version string has the following format: 
+ 	 *		OpenCL<space><major_version.minor_version><space><vendor-specific information>
+	 */
+	string clVersion() {return getStringInfo(CL_DEVICE_VERSION);}
+	
+	/**
+	 * get extensions supported by the device
+	 * 
+	 * Returns:
+	 *		Returns a space separated list of extension names
+	 *		(the extension names themselves do not contain any spaces).  
+	 */
+	string extensions() {return getStringInfo(CL_DEVICE_EXTENSIONS);}
+	
+	
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/error.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,68 @@
+/**
+ * 
+ */
+module opencl.error;
+
+import opencl.c.opencl;
+
+class CLException : Exception
+{
+protected:
+	cl_int _errcode;
+	
+public:
+    this(cl_int errcode, string msg = "", CLException next = null)
+    {
+    	_errcode = errcode;
+    	
+    	// TODO: mapping
+    	switch(errcode)
+    	{
+    		
+    	}
+        super(msg, next);
+    }
+
+    this(cl_int errcode, string file, size_t line, CLException next = null)
+    {
+    	_errcode = errcode;
+    	
+    	super("CLException: ", file, line, next);
+    }
+    
+    /// errcode getter
+    cl_int errCode() {return _errcode;}
+}
+
+/// an unrecognized exception
+class CLUnrecognizedException : CLException {this(cl_int errcode) {super(errcode, "unrecognized OpenCL exception occured");}}
+
+/// 
+class CLInvalidValueException : CLException {this(string msg = "") {super(CL_INVALID_VALUE, msg);}}
+
+/// 
+class CLInvalidPlatformException : CLException {this(string msg = "") {super(CL_INVALID_PLATFORM, msg);}}
+
+/// 
+class CLInvalidDeviceException : CLException {this(string msg = "") {super(CL_INVALID_DEVICE, msg);}}
+
+/// 
+class CLInvalidDeviceTypeException : CLException {this(string msg = "") {super(CL_INVALID_DEVICE_TYPE, msg);}}
+
+/// 
+class CLDeviceNotFoundException : CLException {this(string msg = "") {super(CL_DEVICE_NOT_FOUND, msg);}}
+
+/// 
+class CLDeviceNotAvailableException : CLException {this(string msg = "") {super(CL_DEVICE_NOT_AVAILABLE, msg);}}
+
+/// 
+class CLOutOfHostMemoryException : CLException {this(string msg = "") {super(CL_OUT_OF_HOST_MEMORY, msg);}}
+
+/// 
+class CLInvalidContextException : CLException {this(string msg = "") {super(CL_INVALID_CONTEXT, msg);}}
+
+/// 
+class CLInvalidProgramException : CLException {this(string msg = "") {super(CL_INVALID_PROGRAM, msg);}}
+
+/// 
+//class Exception : CLException {this(string msg = "") {super(CL_, msg);}}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/platform.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,126 @@
+/**
+ * 
+ */
+module opencl.platform;
+
+public import opencl.c.opencl;
+import opencl.device;
+import opencl.error;
+import opencl.wrapper;
+
+//! Platform class
+class CLPlatform : CLWrapper!(cl_platform_id, clGetPlatformInfo)
+{
+public:
+	/// constructor
+	this(cl_platform_id platform)
+	{
+		_object = platform;
+	}
+	
+	/// get the platform name
+	string name()
+	{
+		 return getStringInfo(CL_PLATFORM_NAME);
+	}
+	
+	/// get platform vendor
+	string vendor()
+	{
+		 return getStringInfo(CL_PLATFORM_VENDOR);
+	}
+
+	/// get platform version
+	string clversion()
+	{
+		 return getStringInfo(CL_PLATFORM_VERSION);
+	}
+
+	/// get platform profile
+	string profile()
+	{
+		 return getStringInfo(CL_PLATFORM_PROFILE);
+	}
+
+	/// get platform extensions
+	string extensions()
+	{
+		 return getStringInfo(CL_PLATFORM_EXTENSIONS);
+	}
+	
+	/// returns a list of all devices available on the platform matching deviceType
+	CLDevice[] getDevices(cl_device_type deviceType)
+	{
+		cl_uint numDevices;
+		cl_int res;
+		
+		// get number of devices
+		res = clGetDeviceIDs(_object, deviceType, 0, null, &numDevices);
+		switch(res)
+		{
+			case CL_SUCCESS:
+				break;
+			case CL_INVALID_PLATFORM:
+				throw new CLInvalidPlatformException();
+				break;
+			case CL_INVALID_DEVICE_TYPE:
+				throw new CLInvalidDeviceTypeException("There's no such device type");
+				break;
+			case CL_DEVICE_NOT_FOUND:
+				throw new CLDeviceNotFoundException("Couldn't find an OpenCL device matching the given type");
+				break;
+			default:
+				throw new CLException(res, "unexpected error while getting device count");
+		}
+			
+		// get device IDs
+		auto deviceIDs = new cl_device_id[numDevices];
+		res = clGetDeviceIDs(_object, deviceType, deviceIDs.length, deviceIDs.ptr, null);
+		if(res != CL_SUCCESS)
+			throw new CLException(res);
+		
+		// create CLDevice array
+		auto devices = new CLDevice[numDevices];
+		for(uint i=0; i<numDevices; i++)
+			devices[i] = new CLDevice(this, deviceIDs[i]);
+		
+		return devices;
+	}
+	
+	/// returns a list of all devices
+	CLDevice[] allDevices()	{return getDevices(CL_DEVICE_TYPE_ALL);}
+	
+	/// returns a list of all CPU devices
+	CLDevice[] cpuDevices()	{return getDevices(CL_DEVICE_TYPE_CPU);}
+	
+	/// returns a list of all GPU devices
+	CLDevice[] gpuDevices()	{return getDevices(CL_DEVICE_TYPE_GPU);}
+	
+	/// returns a list of all accelerator devices
+	CLDevice[] accelDevices() {return getDevices(CL_DEVICE_TYPE_ACCELERATOR);}
+	
+	/// get an array of all available platforms
+	static CLPlatform[] getPlatforms()
+	{
+		cl_uint numPlatforms;
+		cl_int res;
+		
+		// get number of platforms
+		res = clGetPlatformIDs(0, null, &numPlatforms);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidValueException();
+			
+		// get platform IDs
+		auto platformIDs = new cl_platform_id[numPlatforms];
+		res = clGetPlatformIDs(platformIDs.length, platformIDs.ptr, null);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidValueException();
+		
+		// create CLPlatform array
+		auto platforms = new CLPlatform[numPlatforms];
+		for(uint i=0; i<numPlatforms; i++)
+			platforms[i] = new CLPlatform(platformIDs[i]);
+		
+		return platforms;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/program.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,169 @@
+/**
+ * 
+ */
+module opencl.program;
+
+import opencl.c.opencl;
+import opencl.wrapper;
+import opencl.device;
+import opencl.context;
+import opencl.error;
+
+/**
+ * An OpenCL program consists of a set of kernels that are identified as functions declared with
+ * the __kernel qualifier in the program source. OpenCL programs may also contain auxiliary
+ * functions and constant data that can be used by __kernel functions. The program executable
+ * can be generated online or offline by the OpenCL compiler for the appropriate target device(s).
+ */
+class CLProgram : CLWrapper!(cl_program, clGetProgramInfo)
+{
+private:
+	CLContext	_context; // the context that contains this program
+//	CLDevice[]	_devices; // can be subset specified with CreateWithBinary
+	string		_sourceCode; // the OpenCL C source code
+public:
+	/**
+	 * creates a program object for a context, and loads the source code specified by the text strings in
+	 * the strings array into the program object. The devices associated with the program object are the
+	 * devices associated with context.
+	 */
+	this(CLContext context, string sourceCode)
+	{
+		cl_int res;
+		size_t* lengths = cast(size_t*) [sourceCode.length];
+		char** ptrs = cast(char**) [sourceCode.ptr];
+		super(clCreateProgramWithSource(context.getObject(), 1, ptrs, lengths, &res));
+		
+		switch (res)
+		{
+			case CL_SUCCESS:
+				_context = context; // TODO: ok like that?
+				_sourceCode = sourceCode;
+				break;
+			case CL_INVALID_CONTEXT:
+				throw new CLInvalidContextException();
+				break;
+			case CL_INVALID_VALUE:
+				throw new CLInvalidValueException("source code string pointer is invalid");
+				break;
+			case CL_OUT_OF_HOST_MEMORY:
+				throw new CLOutOfHostMemoryException();
+				break;
+			default:
+				throw new CLUnrecognizedException(res);
+				break;
+		}
+	}
+	
+	~this()
+	{
+		release();
+	}
+
+	/**
+	 * builds (compiles & links) a program executable from the program source or binary for all the
+	 * devices or a specific device(s) in the OpenCL context associated with program. OpenCL allows
+	 * program executables to be built using the source or the binary.
+	 */
+	CLProgram build()
+	{
+		cl_int res;
+		res = clBuildProgram(_object, 0, null, null, null, null);
+		
+		return this;
+	}
+	
+	CLProgram buildDebug()
+	{
+		cl_int res;
+		res = clBuildProgram(_object, 0, null, "-Werror", null, null);
+		return this;
+	}
+
+	/// increments the context reference count
+	void retain()
+	{
+		cl_int res;
+		res = clRetainProgram(_object);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidProgramException("internal program object is not a valid OpenCL context");
+	}
+	
+	/// decrements the context reference count
+	void release()
+	{
+		cl_int res;
+		res = clReleaseContext(_object);
+		if(res != CL_SUCCESS)
+			throw new CLInvalidProgramException("internal program object is not a valid OpenCL context");
+	}
+
+	/**
+	 * allows the implementation to release the resources allocated by the OpenCL compiler.  This is a
+	 * hint from the application and does not guarantee that the compiler will not be used in the future
+	 * or that the compiler will actually be unloaded by the implementation.  Calls to clBuildProgram
+	 * after clUnloadCompiler will reload the compiler, if necessary, to build the appropriate program executable.
+	 * 
+	 * TODO: should this stay in this class?
+	 */
+	static void unloadCompiler()
+	{
+		cl_int res;
+		res = clUnloadCompiler();
+		if(res != CL_SUCCESS)
+			throw new CLException(res, "failed unloading compiler, this shouldn't happen in OpenCL 1.0");
+	}
+	
+	/// returns the program reference count
+	// TODO: make it package?
+	cl_uint referenceCount()
+	{
+		return getInfo!(cl_uint)(CL_PROGRAM_REFERENCE_COUNT);
+	}
+	
+	/// TODO: check those stuff for consistency with getInfo results
+	CLContext context()
+	{
+		return _context;
+	}
+	
+	/**
+	 * Return the list of devices associated with the program object. This can be the devices associated with context on
+	 * which the program object has been created or can be a subset of devices that are specified when a progam object
+	 * is created using	clCreateProgramWithBinary
+	 */
+	CLDevice[] devices()
+	{
+		cl_device_id[] ids = getArrayInfo!(cl_device_id)(CL_PROGRAM_DEVICES);
+		CLDevice[] res = new CLDevice[ids.length];
+		for(uint i=0; i<ids.length, i++)
+			res[i] = new CLDevice(ids[i]);
+		return res;
+	}
+	
+	///
+	string sourceCode()
+	{
+		return _sourceCode;
+	}
+	
+	/**
+	 * Return the program binaries for all devices associated with the program.
+	 * Returns:
+	 */
+	ubyte[][] binaries()
+	{
+		// TODO: make sure binaries are available?
+		size_t[] sizes = getArrayInfo!(size_t)(CL_PROGRAM_BINARY_SIZES);
+		
+		ubyte*[] ptrs = getArrayInfo!(ubyte*)(CL_PROGRAM_BINARIES);
+		
+		ubyte[][] res = new ubyte[][ptrs.length];
+		for (uint i=0; i<ptrs.length; i++)
+		{
+			res[i] = ptrs[i][0 .. sizes[i]];
+		}
+		
+		return res;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/opencl/wrapper.d	Wed Dec 02 17:40:59 2009 +0100
@@ -0,0 +1,104 @@
+/**
+ * 
+ */
+module opencl.wrapper;
+
+import opencl.error;
+import opencl.c.opencl;
+
+// alternate Info getter functions
+private alias extern(C) cl_int function(const(void)*, const(void*), cl_uint, size_t, void*, size_t*) Func;
+
+/// abstract base class 
+abstract class CLWrapper(T, alias infoFunction)
+{
+protected:
+	T _object = null;
+
+	// should only be used inside here
+	package T getObject()
+	{
+		return _object;
+	}
+	
+	// used for all non-array types
+	T getInfo(T)(cl_uint infoname, Func altFunction = null, cl_device_id device = null)
+	{
+		assert(_object !is null);
+		size_t needed;
+		cl_int res;
+		
+		// get number of needed memory
+		if (altFunction != null && device != null)
+			res = altFunction(_object, device, infoname, 0, null, &needed);
+		else
+			res = infoFunction(_object, infoname, 0, null, &needed);
+
+		// error checking
+		if (res != CL_SUCCESS)
+			throw new CLException(res);
+		
+		assert(needed == T.sizeof); // TODO:
+		
+		T info;
+
+		// get actual data
+		if (altFunction != null && device != null)
+			res = altFunction(_object, device, infoname, T.sizeof, &info, null);
+		else
+			res = infoFunction(_object, infoname, T.sizeof, &info, null);
+		
+		// error checking
+		if (res != CL_SUCCESS)
+			throw new CLException(res);
+		
+		return info;
+	}
+	
+	// helper function for all OpenCL Get*Info functions
+	// used for all array return types
+	T[] getArrayInfo(T)(cl_uint infoname, Func altFunction = null, cl_device_id device = null)
+	{
+		assert(_object !is null);
+		size_t needed;
+		cl_int res;
+
+		// get number of needed memory
+		if (altFunction != null && device != null)
+			res = altFunction(_object, device, infoname, 0, null, &needed);
+		else
+			res = infoFunction(_object, infoname, 0, null, &needed);
+
+		// error checking
+		if (res != CL_SUCCESS)
+			throw new CLException(res);
+		
+		auto buffer = new T[needed];
+
+		// get actual data
+		if (altFunction != null && device != null)
+			res = altFunction(_object, device, infoname, buffer.length, cast(void*)buffer.ptr, null);
+		else
+			res = infoFunction(_object, infoname, buffer.length, cast(void*)buffer.ptr, null);
+		
+		// error checking
+		if (res != CL_SUCCESS)
+			throw new CLException(res);
+		
+		return buffer;
+	}
+	
+	string getStringInfo(cl_uint infoname, Func altFunction = null, cl_device_id device = null)
+	{
+		return cast(string) getArrayInfo!(char)(infoname, altFunction, device);
+	}
+
+	//	static cl_int getInfo(Arg0, Arg1)(Arg0 arg0, Arg1)
+
+public:
+	this() {}
+	this(T obj)
+	{
+		_object = obj;
+	}
+}
\ No newline at end of file