FreeWRL/FreeX3D  3.0.0
OpenCL_Utils.h
1 /*
2 
3 
4 Collision ???
5 
6 */
7 
8 /****************************************************************************
9  This file is part of the FreeWRL/FreeX3D Distribution.
10 
11  Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
12 
13  FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
14  it under the terms of the GNU Lesser Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  FreeWRL/FreeX3D is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
25 ****************************************************************************/
26 
27 
28 #ifndef __FREEWRL_OPENCL_H__
29 #define __FREEWRL_OPENCL_H__
30 
31 #ifdef HAVE_OPENCL
32 // OLD_IPHONE_AQUA #if defined (__APPLE__) || defined(MACOSX) || defined(TARGET_AQUA)
33 // OLD_IPHONE_AQUA #include <OpenCL/opencl.h>
34 // OLD_IPHONE_AQUA #include <OpenGL/CGLDevice.h>
35 // OLD_IPHONE_AQUA #elif defined(_MSC_VER)
36 
37 #if (defined(_MSC_VER)
38  #include <windows.h> //WGL prototyped in wingdi.h
39  #include <CL/opencl.h>
40  #define DEBUG
41 #else //LINUX
42  #include <CL/opencl.h>
43  #include <CL/cl_gl.h>
44 #endif
45 
46 #define TEST_ERR(aa,bb) if (bb!=CL_SUCCESS) printCLError(aa,bb)
47 
48 typedef struct pOpenCL_Utils{
49  cl_context CL_context;
50  cl_command_queue CL_queue;
51  cl_device_id CL_device_id;
52  size_t CL_default_workgroup_size;
53  cl_program coordinateInterpolatorProgram;
54  cl_kernel coordinateInterpolatorKernel;
55  size_t coordinateInterpolator_workgroup_size;
56 }* ppOpenCL_Utils;
57 
58 
59 
60 //void runOpenCLInterpolator(struct CRStruct *route, struct X3D_Node * toNode, int toOffset);
61 void printCLError(const char *where, cl_int err);
62 void fwl_OpenCL_startup(struct tOpenCL_Utils *t);
63 
64 #endif // HAVE_OPENCL
65 #endif /* __FREEWRL_OPENCL_H__ */