Hello forum,

I am working with the OpenCL 1.1 specification and i an having issue with the implementation of the functions mentioned above. Lets narrate the procedure i am trying to do :

1. At the beginning of the main application file , i am defining the following :

Code :
.....
.....
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#include <CL/cl_gl.h>
#endif
................
...............
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
   const cl_context_properties *properties,
   cl_gl_context_info param_name,
   size_t param_value_size,
   void *param_value,
   size_t *param_value_size_ret);
 
// Rename references to this dynamically linked function to avoid
// collision with static link version
#define clGetGLContextInfoKHR clGetGLContextInfoKHR_proc
static clGetGLContextInfoKHR_fn clGetGLContextInfoKHR;

Then i am defining the context as follows:

Code :
   cl_context_properties cps[] =
      {
	 CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(),
	 CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(),
	 CL_CONTEXT_PLATFORM, (cl_context_properties)platform,
	 0
      };
 
   //re-initialize the properties if the platform is found
   cl_context_properties *cprops = (NULL == platform) ? NULL : cps;
 
 
   if(!clGetGLContextInfoKHR)
   {
      clGetGLContextInfoKHR = (clGetGLContextInfoKHR_fn) clGetExtensionFunctionAddress("clGetGLContextInfoKHR");
 
      if(!clGetGLContextInfoKHR)
      {
	 std::cout << "Failed to query proc address for clGetGLContextInfoKHR." << std::endl;
	 exit(EXIT_FAILURE);
      }
   }
 
   size_t deviceSize;
 
   status = clGetGLContextInfoKHR(cps,CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR,0,NULL,&deviceSize);
 
 
   if(deviceSize == 0)
   {
      std::cout << "Current context does not support any device " << std::endl;
      exit(0);
   }


I am getting device size 0 which should not be. It should be 1.

Any hint on what i am missing ?


Thanks

Sajjadul