Fixing some opencl issues.

This commit is contained in:
Colin LeMahieu 2016-04-06 19:21:45 -05:00
commit 06073dcba3
3 changed files with 10 additions and 5 deletions

View file

@ -55,6 +55,8 @@ include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets
find_package (cppnetlib)
include_directories (${CPPNETLIB_INCLUDE_DIRS})
include_directories (${OPENCL_INCLUDE_DIRS})
add_library (ed25519
ed25519-donna/ed25519-donna-portable.h
ed25519-donna/ed25519-hash-custom.h

View file

@ -20,7 +20,7 @@ public:
clCreateCommandQueue = reinterpret_cast <decltype (clCreateCommandQueue)> (dlsym(opencl_library, "clCreateCommandQueue"));
clCreateBuffer = reinterpret_cast <decltype (clCreateBuffer)> (dlsym(opencl_library, "clCreateBuffer"));
clCreateProgramWithSource = reinterpret_cast <decltype (clCreateProgramWithSource)> (dlsym(opencl_library, "clCreateProgramWithSource"));
clCreateBuildProgram = reinterpret_cast <decltype (clCreateBuildProgram)> (dlsym(opencl_library, "clCreateBuildProgram"));
clBuildProgram = reinterpret_cast <decltype (clBuildProgram)> (dlsym(opencl_library, "clBuildProgram"));
clCreateKernel = reinterpret_cast <decltype (clCreateKernel)> (dlsym(opencl_library, "clCreateKernel"));
clSetKernelArg = reinterpret_cast <decltype (clSetKernelArg)> (dlsym(opencl_library, "clSetKernelArg"));
clReleaseKernel = reinterpret_cast <decltype (clReleaseKernel)> (dlsym(opencl_library, "clReleaseKernel"));

View file

@ -19,8 +19,8 @@ namespace
clCreateContext = reinterpret_cast <decltype (clCreateContext)> (GetProcAddress(opencl_library, "clCreateContext"));
clCreateCommandQueue = reinterpret_cast <decltype (clCreateCommandQueue)> (GetProcAddress(opencl_library, "clCreateCommandQueue"));
clCreateBuffer = reinterpret_cast <decltype (clCreateBuffer)> (GetProcAddress(opencl_library, "clCreateBuffer"));
clCreateProgramWithSource = reinterpret_cast <decltype (clCreateProgramWithSource)> (dlsym(opencl_library, "clCreateProgramWithSource"));
clCreateBuildProgram = reinterpret_cast <decltype (clCreateBuildProgram)> (GetProcAddress(opencl_library, "clCreateBuildProgram"));
clCreateProgramWithSource = reinterpret_cast <decltype (clCreateProgramWithSource)> (GetProcAddress(opencl_library, "clCreateProgramWithSource"));
clBuildProgram = reinterpret_cast <decltype (clBuildProgram)> (GetProcAddress(opencl_library, "clBuildProgram"));
clCreateKernel = reinterpret_cast <decltype (clCreateKernel)> (GetProcAddress(opencl_library, "clCreateKernel"));
clSetKernelArg = reinterpret_cast <decltype (clSetKernelArg)> (GetProcAddress(opencl_library, "clSetKernelArg"));
clReleaseKernel = reinterpret_cast <decltype (clReleaseKernel)> (GetProcAddress(opencl_library, "clReleaseKernel"));
@ -34,7 +34,7 @@ namespace
}
~opencl_initializer()
{
dlclose(opencl_library);
FreeLibrary(opencl_library);
}
HMODULE opencl_library;
cl_int(*clGetPlatformIDs) (cl_uint, cl_platform_id *, cl_uint *);
@ -71,7 +71,10 @@ cl_int clGetPlatformIDs(cl_uint num_entries, cl_platform_id * platforms, cl_uint
else
{
result = CL_SUCCESS;
*num_platforms = 0;
if (num_platforms != nullptr)
{
*num_platforms = 0;
}
}
return result;
}