I'm french, so please excuse my spelling mistakes.
I need to implement an octree structure on GPU (using 3D texture).
I thought OpenCL was a good idea to do that: 3D Image reading and writing seem easy to use.
Unfortunately, I really don't know OpenCL, and more I'm searching, more lost I am.
Plus, I'm working in a really unfriendly environment (Windows 7 + Visual Studio 200. That's not my choice.
I'm not even sure that Visual Studio is able to understand OpenCL.
I found the headers here: http://www.khronos.org/registry/cl/
I have: cl.h, cl.hpp, cl_ext.h, cl_gl.h, cl_gl_ext.h, cl_platform.h, opencl.h.
And I have OpenCL.lib (I don't remember where I got it).
However, even a very simple code doesn't compile. A lot of functions, types, and macros are not know by the compiler.
I get 4 errors on this line:
Type sampler_t, and the 3 next macros are unknown (undeclared identifiers).Code :sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_REPEAT | CLK_FILTER_NEAREST;
The functionis understood. The code compile.Code :clCreateImage3D
But I can't check if it really works because the functionis unknown.Code :read_imageui
A last example.
All the types float2, float4, int2, int4, unsigned int4, etc... are undefined.
If I add 'cl_' before the names, it "works":
However, I can only access to v.s, which is a table of float. I can't acces to v.x, v.y, v.z, and v.w I expected.Code :cl_float4 v; float test = v.s;
The types float4 and cl_float4 seem different.
I put in my header the following:And VS is set to use "CL/openCL.lib".Code :#include <CL/opencl.h>
I have this basic code compiling (I don't really know if it is working):
Code :// OpenCL Init cl_uint numDevicesReturned; cl_device_id devices; cl_int err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &devices, &numDevicesReturned); cl_context context; context = clCreateContext (0, 1, devices, NULL, NULL, &err); cl_command_queue queueGpu; queueGpu = clCreateCommandQueue (context, devices, 0, &err); // OpenCL Init end
Is there something I did wrong ?
Do you have any idea on where I can find the headers which declares the functions, variables, and macros I need ?
Or if it is a problem from Visual Studio, do you know how to configure it correctly ?
If you need more information to help me, don't hesitate to ask me.
And, of course, do you know where I can find a complete implementation of octree on GPU using OpenCL ?
Thank you for your help.