[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58159] branches/soc-2013-vse/intern/ opencl: Updating clew (glew for opencl)

Alexander Kuznetsov kuzsasha at gmail.com
Wed Jul 10 21:12:15 CEST 2013


Revision: 58159
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58159
Author:   alexk
Date:     2013-07-10 19:12:15 +0000 (Wed, 10 Jul 2013)
Log Message:
-----------
Updating clew (glew for opencl)
gl-cl module
a callback function from opencl 1.1 (most support it)

Couldn't find official upgrade for this lib
Maybe we should clean up later

Modified Paths:
--------------
    branches/soc-2013-vse/intern/opencl/CMakeLists.txt
    branches/soc-2013-vse/intern/opencl/OCL_opencl.h
    branches/soc-2013-vse/intern/opencl/intern/clew.c
    branches/soc-2013-vse/intern/opencl/intern/clew.h

Added Paths:
-----------
    branches/soc-2013-vse/intern/opencl/intern/clew_gl.h

Modified: branches/soc-2013-vse/intern/opencl/CMakeLists.txt
===================================================================
--- branches/soc-2013-vse/intern/opencl/CMakeLists.txt	2013-07-10 17:25:52 UTC (rev 58158)
+++ branches/soc-2013-vse/intern/opencl/CMakeLists.txt	2013-07-10 19:12:15 UTC (rev 58159)
@@ -34,6 +34,7 @@
 set(SRC
 	OCL_opencl.h
 	intern/clew.h
+	intern/clew_gl.h
 	intern/clew.c
 	intern/OCL_opencl.c
 )

Modified: branches/soc-2013-vse/intern/opencl/OCL_opencl.h
===================================================================
--- branches/soc-2013-vse/intern/opencl/OCL_opencl.h	2013-07-10 17:25:52 UTC (rev 58158)
+++ branches/soc-2013-vse/intern/opencl/OCL_opencl.h	2013-07-10 19:12:15 UTC (rev 58159)
@@ -28,6 +28,7 @@
 #endif
 
 #include "intern/clew.h"
+#include "intern/clew_gl.h"
 void OCL_init(void);
 
 #ifdef __cplusplus

Modified: branches/soc-2013-vse/intern/opencl/intern/clew.c
===================================================================
--- branches/soc-2013-vse/intern/opencl/intern/clew.c	2013-07-10 17:25:52 UTC (rev 58158)
+++ branches/soc-2013-vse/intern/opencl/intern/clew.c	2013-07-10 19:12:15 UTC (rev 58159)
@@ -7,6 +7,7 @@
 //////////////////////////////////////////////////////////////////////////
 
 #include "clew.h"
+#include "clew_gl.h"
 
 //! \file clew.c
 //! \brief OpenCL run-time loader source
@@ -111,6 +112,21 @@
 PFNCLENQUEUEWAITFOREVENTS           __oclEnqueueWaitForEvents          = NULL;
 PFNCLENQUEUEBARRIER                 __oclEnqueueBarrier                = NULL;
 PFNCLGETEXTENSIONFUNCTIONADDRESS    __oclGetExtensionFunctionAddress   = NULL;
+PFNCLSETEVENTCALLBACK				__oclSetEventCallback			   = NULL;
+
+PFNCLCREATEFROMGLBUFFER __oclCreateFromGLBuffer = NULL;
+PFNCLCREATEFROMGLTEXTURE __oclCreateFromGLTexture = NULL;
+PFNCLCREATEFROMGLRENDERBUFFER __oclCreateFromGLRenderbuffer = NULL;
+PFNCLGETGLOBJECTINFO __oclGetGLObjectInfo = NULL;
+PFNCLGETGLTEXTUREINFO __oclGetGLTextureInfo = NULL;
+PFNCLENQUEUEACQUIREGLOBJECTS __oclEnqueueAcquireGLObjects = NULL;
+PFNCLENQUEUERELEASEGLOBJECTS __oclEnqueueReleaseGLObjects = NULL;
+PFNCLCREATEFROMGLTEXTURE2D __oclCreateFromGLTexture2D = NULL;
+PFNCLCREATEFROMGLTEXTURE3D __oclCreateFromGLTexture3D = NULL;
+PFNCLGETGLCONTEXTINFOKHR __oclGetGLContextInfoKHR = NULL;
+
+
+
 #endif  //  CLCC_GENERATE_DOCUMENTATION
 
 
@@ -227,7 +243,23 @@
     __oclEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
     __oclEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
     __oclGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
+	__oclSetEventCallback			   = (PFNCLSETEVENTCALLBACK            )CLCC_DYNLIB_IMPORT(module, "clSetEventCallback");
 
+
+
+	__oclCreateFromGLBuffer = (PFNCLCREATEFROMGLBUFFER)CLCC_DYNLIB_IMPORT(module, "clCreateFromGLBuffer");
+	__oclCreateFromGLTexture = (PFNCLCREATEFROMGLTEXTURE )CLCC_DYNLIB_IMPORT(module, "clCreateFromGLTexture");
+	__oclCreateFromGLRenderbuffer  = (PFNCLCREATEFROMGLRENDERBUFFER)CLCC_DYNLIB_IMPORT(module, "clCreateFromGLRenderbuffer");
+	__oclGetGLObjectInfo  = (PFNCLGETGLOBJECTINFO)CLCC_DYNLIB_IMPORT(module, "clGetGLObjectInfo");
+	__oclGetGLTextureInfo  = (PFNCLGETGLTEXTUREINFO)CLCC_DYNLIB_IMPORT(module, "clGetGLTextureInfo");
+	__oclEnqueueAcquireGLObjects  = (PFNCLENQUEUEACQUIREGLOBJECTS)CLCC_DYNLIB_IMPORT(module, "clEnqueueAcquireGLObjects");
+	__oclEnqueueReleaseGLObjects = (PFNCLENQUEUERELEASEGLOBJECTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueReleaseGLObjects");
+	__oclCreateFromGLTexture2D  = (PFNCLCREATEFROMGLTEXTURE2D)CLCC_DYNLIB_IMPORT(module, "clCreateFromGLTexture2D");
+	__oclCreateFromGLTexture3D  = (PFNCLCREATEFROMGLTEXTURE2D)CLCC_DYNLIB_IMPORT(module, "clCreateFromGLTexture3D");
+	__oclGetGLContextInfoKHR  = (PFNCLGETGLCONTEXTINFOKHR)CLCC_DYNLIB_IMPORT(module, "clGetGLContextInfoKHR");
+
+
+
     return CLEW_SUCCESS;
 }
 

Modified: branches/soc-2013-vse/intern/opencl/intern/clew.h
===================================================================
--- branches/soc-2013-vse/intern/opencl/intern/clew.h	2013-07-10 17:25:52 UTC (rev 58158)
+++ branches/soc-2013-vse/intern/opencl/intern/clew.h	2013-07-10 19:12:15 UTC (rev 58159)
@@ -71,9 +71,11 @@
 #if defined(_WIN32)
 #define CL_API_ENTRY
 #define CL_API_CALL __stdcall
+#define CL_CALLBACK __stdcall
 #else
 #define CL_API_ENTRY
 #define CL_API_CALL
+#define CL_CALLBACK
 #endif
 
 #if defined(__APPLE__)
@@ -484,6 +486,32 @@
 #define CL_DEVICE_VERSION                           0x102F
 #define CL_DEVICE_EXTENSIONS                        0x1030
 #define CL_DEVICE_PLATFORM                          0x1031
+#define CL_DEVICE_DOUBLE_FP_CONFIG                  0x1032
+/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF       0x1034
+#define CL_DEVICE_HOST_UNIFIED_MEMORY               0x1035
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR          0x1036
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT         0x1037
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT           0x1038
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG          0x1039
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT         0x103A
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE        0x103B
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF          0x103C
+#define CL_DEVICE_OPENCL_C_VERSION                  0x103D
+#define CL_DEVICE_LINKER_AVAILABLE                  0x103E
+#define CL_DEVICE_BUILT_IN_KERNELS                  0x103F
+#define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE             0x1040
+#define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE              0x1041
+#define CL_DEVICE_PARENT_DEVICE                     0x1042
+#define CL_DEVICE_PARTITION_MAX_SUB_DEVICES         0x1043
+#define CL_DEVICE_PARTITION_PROPERTIES              0x1044
+#define CL_DEVICE_PARTITION_AFFINITY_DOMAIN         0x1045
+#define CL_DEVICE_PARTITION_TYPE                    0x1046
+#define CL_DEVICE_REFERENCE_COUNT                   0x1047
+#define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC       0x1048
+#define CL_DEVICE_PRINTF_BUFFER_SIZE                0x1049
+#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT             0x104A
+#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT      0x104B
 
 // cl_device_fp_config - bitfield
 #define CL_FP_DENORM                                (1 << 0)
@@ -1132,6 +1160,16 @@
 typedef CL_API_ENTRY cl_int (CL_API_CALL *
 PFNCLENQUEUEBARRIER)(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
 
+
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *
+		PFNCLSETEVENTCALLBACK) (	cl_event event,
+	cl_int  /*command_exec_callback_type */,
+	void (CL_CALLBACK  *pfn_event_notify) (cl_event event, cl_int event_command_exec_status, void *user_data),
+	void */*user_data*/);
+
+
+
 // Extension function access
 //
 // Returns the extension function address for the given function name,
@@ -1230,6 +1268,7 @@
 CLEW_FUN_EXPORT     PFNCLENQUEUEWAITFOREVENTS           __oclEnqueueWaitForEvents          ;
 CLEW_FUN_EXPORT     PFNCLENQUEUEBARRIER                 __oclEnqueueBarrier                ;
 CLEW_FUN_EXPORT     PFNCLGETEXTENSIONFUNCTIONADDRESS    __oclGetExtensionFunctionAddress   ;
+CLEW_FUN_EXPORT		PFNCLSETEVENTCALLBACK				__oclSetEventCallback			   ;
 
 
 #define	clGetPlatformIDs                CLEW_GET_FUN(__oclGetPlatformIDs                )
@@ -1298,6 +1337,7 @@
 #define	clEnqueueWaitForEvents          CLEW_GET_FUN(__oclEnqueueWaitForEvents          )
 #define	clEnqueueBarrier                CLEW_GET_FUN(__oclEnqueueBarrier                )
 #define	clGetExtensionFunctionAddress   CLEW_GET_FUN(__oclGetExtensionFunctionAddress   )
+#define clSetEventCallback				CLEW_GET_FUN(__oclSetEventCallback				)
 
 #endif  //  CLCC_GENERATE_DOCUMENTATION
 

Added: branches/soc-2013-vse/intern/opencl/intern/clew_gl.h
===================================================================
--- branches/soc-2013-vse/intern/opencl/intern/clew_gl.h	                        (rev 0)
+++ branches/soc-2013-vse/intern/opencl/intern/clew_gl.h	2013-07-10 19:12:15 UTC (rev 58159)
@@ -0,0 +1,193 @@
+/**********************************************************************************
+ * Copyright (c) 2008 - 2012 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.
+ **********************************************************************************/
+
+#ifndef __OPENCL_CL_GL_H
+#define __OPENCL_CL_GL_H
+
+#include "clew.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef cl_uint     cl_gl_object_type;
+typedef cl_uint     cl_gl_texture_info;
+typedef cl_uint     cl_gl_platform_info;
+typedef struct __GLsync *cl_GLsync;
+
+/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken           */
+#define CL_GL_OBJECT_BUFFER                     0x2000
+#define CL_GL_OBJECT_TEXTURE2D                  0x2001
+#define CL_GL_OBJECT_TEXTURE3D                  0x2002
+#define CL_GL_OBJECT_RENDERBUFFER               0x2003
+#define CL_GL_OBJECT_TEXTURE2D_ARRAY            0x200E
+#define CL_GL_OBJECT_TEXTURE1D                  0x200F
+#define CL_GL_OBJECT_TEXTURE1D_ARRAY            0x2010
+#define CL_GL_OBJECT_TEXTURE_BUFFER             0x2011
+
+/* cl_gl_texture_info           */
+#define CL_GL_TEXTURE_TARGET                    0x2004

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list