I recently began incorporating OpenCL into my OpenGL application that renders a basic particle system, the basic interoperation–without events–between the two works fine. However, having tried to use the clCreateEventFromGLsyncKHR
function in order to improve performance instead of having to call glFinish
and clFinish
, I am unable to get the running program as the program complains with the following error:
error LNK2019: unresolved external symbol _clCreateEventFromGLsyncKHR
I have tried to use both of the provided functions used to obtain extension-function pointers (clGetExtensionFunctionAddressForPlatform
, clGetExtensionFunctionAddress
) but for reasons I cant fathom, I am not able to get it to work.
Sample code:
#include <CL/cl_gl_ext.h>
typedef cl_event (*PFNCLCREATEEVENTFROMGLSYNCKHR) (cl_context context, cl_GLsync sync, cl_int *errcode_ret);
PFNCLCREATEEVENTFROMGLSYNCKHR clCreateEventFromGLsyncKHR = (PFNCLCREATEEVENTFROMGLSYNCKHR)clGetExtensionFunctionAddressForPlatform(opencl::target::inst()->platform(), "clCreateEventFromGLsyncKHR");
GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
cl_event gl_event = clCreateEventFromGLsyncKHR(opencl::contexts["GL_CL_context"]->_get(), sync, NULL );
Would anyone kindly assist me in understanding as to where it is I am going wrong?
For those interested:
Name: GeForce GT 740M
Vendor: NVIDIA Corporation
Device OpenCL C version: OpenCL C 1.1
Driver version: 327.23
Profile: FULL_PROFILE
Version: OpenCL 1.1 CUDA
Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_d3d9_sharing cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_compiler_options
cl_nv_device_attribute_query cl_nv_pragma_unroll cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64
Update The above code still does not work if I use a device that supports the cl_khr_gl_event extension