Unifying the OpenCL stack to work with latest Linux CPU headers. Fixed a small issue...
authorhlthantr <devnull@localhost>
Wed, 10 Aug 2011 22:23:22 +0000 (22:23 +0000)
committerKeith Packard <keithp@keithp.com>
Fri, 10 Aug 2012 23:14:47 +0000 (16:14 -0700)
include/CL/cl.h
include/CL/cl_d3d10.h
include/CL/cl_gl.h
include/CL/cl_platform.h
src/cl_device_id.c

index 051fad5..13b0b0d 100644 (file)
@@ -138,7 +138,7 @@ typedef struct _cl_buffer_region {
 #define CL_INVALID_EVENT_WAIT_LIST                  -57
 #define CL_INVALID_EVENT                            -58
 #define CL_INVALID_OPERATION                        -59
-#define CL_INVALID_GL                        -60
+#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
@@ -312,9 +312,9 @@ typedef struct _cl_buffer_region {
 #define CL_FLOAT                                    0x10DE
 
 /* cl_mem_type */
-#define CL_MEM_BUFFER                        0x10F0
-#define CL_MEM_IMAGE2D                       0x10F1
-#define CL_MEM_IMAGE3D                       0x10F2
+#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
@@ -413,10 +413,10 @@ typedef struct _cl_buffer_region {
 #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                 0x11FD
+#define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
 #define CL_COMMAND_MARKER                           0x11FE
-#define CL_COMMAND_ACQUIRE_GLS               0x11FF
-#define CL_COMMAND_RELEASE_GLS               0x1200
+#define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x11FF
+#define CL_COMMAND_RELEASE_GL_OBJECTS               0x1200
 #define CL_COMMAND_READ_BUFFER_RECT                 0x1201
 #define CL_COMMAND_WRITE_BUFFER_RECT                0x1202
 #define CL_COMMAND_COPY_BUFFER_RECT                 0x1203
index b146f2c..f36ca4b 100644 (file)
@@ -22,7 +22,9 @@
 #ifndef __OPENCL_CL_D3D10_H
 #define __OPENCL_CL_D3D10_H
 
+#ifdef __D3D10__
 #include <d3d10.h>
+#endif
 #include <CL/cl.h>
 #include <CL/cl_platform.h>
 
@@ -64,10 +66,15 @@ typedef cl_uint cl_d3d10_device_set_khr;
 #define CL_IMAGE_D3D10_SUBRESOURCE_KHR               0x4016
 
 // cl_command_type
-#define CL_COMMAND_ACQUIRE_D3D10S_KHR         0x4017
-#define CL_COMMAND_RELEASE_D3D10S_KHR         0x4018
+#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR         0x4017
+#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR         0x4018
 
 /******************************************************************************/
+#ifndef __D3D10__
+typedef struct {int i;} ID3D10Buffer;
+typedef struct {int i;} ID3D10Texture2D;
+typedef struct {int i;} ID3D10Texture3D;
+#endif
 
 typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
     cl_platform_id             platform,
index 4aca594..e2e536e 100644 (file)
@@ -45,10 +45,10 @@ typedef cl_uint     cl_gl_platform_info;
 typedef struct __GLsync *cl_GLsync;
 
 /* cl_gl_object_type */
-#define CL_GL_BUFFER             0x2000
-#define CL_GL_TEXTURE2D          0x2001
-#define CL_GL_TEXTURE3D          0x2002
-#define CL_GL_RENDERBUFFER       0x2003
+#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
index 0e58eb8..3d87457 100644 (file)
@@ -99,7 +99,7 @@ typedef double                  cl_double;
 #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_FLT_EPSILON      MAKE_HEX_DOUBLE(0x1.0p-23f, 0x1L, -23)
 
 #define CL_DBL_DIG          15
 #define CL_DBL_MANT_DIG     53
index 219958a..ff2a7be 100644 (file)
@@ -110,25 +110,27 @@ cl_get_device_ids(cl_platform_id    platform,
                   cl_uint *         num_devices)
 {
   /* Check parameter consistency */
-  if (UNLIKELY(num_entries == 0 && devices == NULL))
+  if (UNLIKELY(num_entries == 0 && devices == NULL && num_devices == NULL))
     return CL_SUCCESS;
-  if (UNLIKELY(devices == NULL))
+  if (UNLIKELY(devices == NULL && num_devices == NULL))
     return CL_INVALID_VALUE;
   if (UNLIKELY(platform != NULL && platform != intel_platform))
     return CL_INVALID_PLATFORM;
-  if (UNLIKELY(device_type == CL_DEVICE_TYPE_CPU))
-    return CL_INVALID_DEVICE_TYPE;
+  if (num_devices && (device_type == CL_DEVICE_TYPE_CPU)) {
+       *num_devices = 0;
+       return CL_SUCCESS;      
+  }
 
   /* Detect our device (reject a non intel one or gen<6) */
-  if (UNLIKELY((*devices = cl_get_gt_device()) != NULL)) {
+  if (devices && UNLIKELY((*devices = cl_get_gt_device()) != NULL)) {
     if (num_devices)
       *num_devices = 1;
     return CL_SUCCESS;
   }
   else {
     if (num_devices)
-      *num_devices = 0;
-    return CL_DEVICE_NOT_FOUND;
+      *num_devices = 1;
+    return CL_SUCCESS;
   }
 }