@@ -23,6 +23,8 @@ typedef cl_context (*p_clCreateContext)(
2323typedef cl_int (*p_clReleaseContext)(cl_context);
2424typedef cl_command_queue (*p_clCreateCommandQueueWithProperties)(
2525 cl_context, cl_device_id, const cl_queue_properties *, cl_int *);
26+ typedef cl_command_queue (*p_clCreateCommandQueue)(
27+ cl_context, cl_device_id, cl_command_queue_properties, cl_int *);
2628typedef cl_int (*p_clReleaseCommandQueue)(cl_command_queue);
2729typedef cl_mem (*p_clCreateBuffer)(cl_context, cl_mem_flags, size_t , void *,
2830 cl_int *);
@@ -67,6 +69,7 @@ static p_clCreateContext f_clCreateContext;
6769static p_clReleaseContext f_clReleaseContext;
6870static p_clCreateCommandQueueWithProperties
6971 f_clCreateCommandQueueWithProperties;
72+ static p_clCreateCommandQueue f_clCreateCommandQueue;
7073static p_clReleaseCommandQueue f_clReleaseCommandQueue;
7174static p_clCreateBuffer f_clCreateBuffer;
7275static p_clReleaseMemObject f_clReleaseMemObject;
@@ -111,6 +114,8 @@ bool OpenCLContext::loadLibraries() {
111114 f_clCreateCommandQueueWithProperties =
112115 openclLib->getFunction <p_clCreateCommandQueueWithProperties>(
113116 " clCreateCommandQueueWithProperties" );
117+ f_clCreateCommandQueue =
118+ openclLib->getFunction <p_clCreateCommandQueue>(" clCreateCommandQueue" );
114119 f_clReleaseCommandQueue = openclLib->getFunction <p_clReleaseCommandQueue>(
115120 " clReleaseCommandQueue" );
116121 f_clCreateBuffer =
@@ -387,7 +392,13 @@ void OpenCLContext::createContext() {
387392
388393void OpenCLContext::createCommandQueue () {
389394 cl_int err;
390- commandQueue = f_clCreateCommandQueueWithProperties (context, device, 0 , &err);
395+ if (f_clCreateCommandQueueWithProperties) {
396+ commandQueue = f_clCreateCommandQueueWithProperties (context, device, nullptr , &err);
397+ } else if (f_clCreateCommandQueue) {
398+ commandQueue = f_clCreateCommandQueue (context, device, 0 , &err);
399+ } else {
400+ throw std::runtime_error (" OpenCL command queue creation functions not found" );
401+ }
391402 if (err != CL_SUCCESS ) {
392403 throw std::runtime_error (" Failed to create OpenCL command queue" );
393404 }
0 commit comments