Merge pull request #9590 from alalek:ocl_runtime_fix

pull/9606/head
Alexander Alekhin 7 years ago
commit 26ad229bd6
  1. 4
      modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp
  2. 4
      modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
  3. 12
      modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp
  4. 12
      modules/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp
  5. 4
      modules/core/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp
  6. 92
      modules/core/src/opencl/runtime/autogenerated/opencl_core_static_impl.hpp
  7. 14
      modules/core/src/opencl/runtime/autogenerated/opencl_gl_static_impl.hpp
  8. 24
      modules/core/src/opencl/runtime/generator/common.py
  9. 3
      modules/core/src/opencl/runtime/generator/generate.sh
  10. 4
      modules/core/src/opencl/runtime/generator/parser_cl.py
  11. 4
      modules/core/src/opencl/runtime/generator/template/opencl_core.hpp.in
  12. 4
      modules/core/src/opencl/runtime/generator/template/opencl_gl.hpp.in
  13. 1
      modules/core/src/opencl/runtime/generator/template/static_impl.hpp.in
  14. 40
      modules/core/src/opencl/runtime/opencl_core.cpp

@ -95,7 +95,11 @@
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_
#define clWaitForEvents clWaitForEvents_
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
// generated by parser_cl.py
#undef clBuildProgram

@ -17,7 +17,11 @@
#define clGetGLObjectInfo clGetGLObjectInfo_
#define clGetGLTextureInfo clGetGLTextureInfo_
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
// generated by parser_cl.py
#undef clCreateFromGLBuffer

@ -44,16 +44,6 @@
#ifdef HAVE_OPENCL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
#else // HAVE_OPENCL_STATIC
#ifndef CL_RUNTIME_EXPORT
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
#define CL_RUNTIME_EXPORT __declspec(dllimport)
@ -76,8 +66,6 @@
#include "autogenerated/opencl_core.hpp"
#endif // HAVE_OPENCL_STATIC
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
#endif

@ -46,20 +46,8 @@
#include "opencl_core.hpp"
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
#else // HAVE_OPENCL_STATIC
#include "autogenerated/opencl_gl.hpp"
#endif // HAVE_OPENCL_STATIC
#endif // defined HAVE_OPENCL && defined HAVE_OPENGL
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP

@ -8,8 +8,6 @@
#include "opencl_svm_definitions.hpp"
#ifndef HAVE_OPENCL_STATIC
#undef clSVMAlloc
#define clSVMAlloc clSVMAlloc_pfn
#undef clSVMFree
@ -45,8 +43,6 @@ extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr,
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
#endif // HAVE_OPENCL_STATIC
#endif // HAVE_OPENCL_SVM
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP

@ -0,0 +1,92 @@
//
// AUTOGENERATED, DO NOT EDIT
//
// generated by parser_cl.py
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clBuildProgram_pfn)(cl_program, cl_uint, const cl_device_id*, const char*, void (CL_CALLBACK*) (cl_program, void*), void*) = clBuildProgram;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCompileProgram_pfn)(cl_program, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, const char**, void (CL_CALLBACK*) (cl_program, void*), void*) = clCompileProgram;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateBuffer_pfn)(cl_context, cl_mem_flags, size_t, void*, cl_int*) = clCreateBuffer;
CL_RUNTIME_EXPORT cl_command_queue (CL_API_CALL*clCreateCommandQueue_pfn)(cl_context, cl_device_id, cl_command_queue_properties, cl_int*) = clCreateCommandQueue;
CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContext_pfn)(const cl_context_properties*, cl_uint, const cl_device_id*, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*) = clCreateContext;
CL_RUNTIME_EXPORT cl_context (CL_API_CALL*clCreateContextFromType_pfn)(const cl_context_properties*, cl_device_type, void (CL_CALLBACK*) (const char*, const void*, size_t, void*), void*, cl_int*) = clCreateContextFromType;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage_pfn)(cl_context, cl_mem_flags, const cl_image_format*, const cl_image_desc*, void*, cl_int*) = clCreateImage;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage2D_pfn)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*) = clCreateImage2D;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateImage3D_pfn)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, size_t, size_t, void*, cl_int*) = clCreateImage3D;
CL_RUNTIME_EXPORT cl_kernel (CL_API_CALL*clCreateKernel_pfn)(cl_program, const char*, cl_int*) = clCreateKernel;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateKernelsInProgram_pfn)(cl_program, cl_uint, cl_kernel*, cl_uint*) = clCreateKernelsInProgram;
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBinary_pfn)(cl_context, cl_uint, const cl_device_id*, const size_t*, const unsigned char**, cl_int*, cl_int*) = clCreateProgramWithBinary;
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBuiltInKernels_pfn)(cl_context, cl_uint, const cl_device_id*, const char*, cl_int*) = clCreateProgramWithBuiltInKernels;
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithSource_pfn)(cl_context, cl_uint, const char**, const size_t*, cl_int*) = clCreateProgramWithSource;
CL_RUNTIME_EXPORT cl_sampler (CL_API_CALL*clCreateSampler_pfn)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*) = clCreateSampler;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateSubBuffer_pfn)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*) = clCreateSubBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateSubDevices_pfn)(cl_device_id, const cl_device_partition_property*, cl_uint, cl_device_id*, cl_uint*) = clCreateSubDevices;
CL_RUNTIME_EXPORT cl_event (CL_API_CALL*clCreateUserEvent_pfn)(cl_context, cl_int*) = clCreateUserEvent;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrier_pfn)(cl_command_queue) = clEnqueueBarrier;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrierWithWaitList_pfn)(cl_command_queue, cl_uint, const cl_event*, cl_event*) = clEnqueueBarrierWithWaitList;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBuffer_pfn)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*) = clEnqueueCopyBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferRect_pfn)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*) = clEnqueueCopyBufferRect;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyBufferToImage_pfn)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*) = clEnqueueCopyBufferToImage;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImage_pfn)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*) = clEnqueueCopyImage;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueCopyImageToBuffer_pfn)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, size_t, cl_uint, const cl_event*, cl_event*) = clEnqueueCopyImageToBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillBuffer_pfn)(cl_command_queue, cl_mem, const void*, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*) = clEnqueueFillBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueFillImage_pfn)(cl_command_queue, cl_mem, const void*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*) = clEnqueueFillImage;
CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapBuffer_pfn)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event*, cl_event*, cl_int*) = clEnqueueMapBuffer;
CL_RUNTIME_EXPORT void* (CL_API_CALL*clEnqueueMapImage_pfn)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t*, const size_t*, size_t*, size_t*, cl_uint, const cl_event*, cl_event*, cl_int*) = clEnqueueMapImage;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarker_pfn)(cl_command_queue, cl_event*) = clEnqueueMarker;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarkerWithWaitList_pfn)(cl_command_queue, cl_uint, const cl_event*, cl_event*) = clEnqueueMarkerWithWaitList;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMigrateMemObjects_pfn)(cl_command_queue, cl_uint, const cl_mem*, cl_mem_migration_flags, cl_uint, const cl_event*, cl_event*) = clEnqueueMigrateMemObjects;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNDRangeKernel_pfn)(cl_command_queue, cl_kernel, cl_uint, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*) = clEnqueueNDRangeKernel;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueNativeKernel_pfn)(cl_command_queue, void (CL_CALLBACK*) (void*), void*, size_t, cl_uint, const cl_mem*, const void**, cl_uint, const cl_event*, cl_event*) = clEnqueueNativeKernel;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBuffer_pfn)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*) = clEnqueueReadBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadBufferRect_pfn)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*) = clEnqueueReadBufferRect;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReadImage_pfn)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*) = clEnqueueReadImage;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueTask_pfn)(cl_command_queue, cl_kernel, cl_uint, const cl_event*, cl_event*) = clEnqueueTask;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueUnmapMemObject_pfn)(cl_command_queue, cl_mem, void*, cl_uint, const cl_event*, cl_event*) = clEnqueueUnmapMemObject;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWaitForEvents_pfn)(cl_command_queue, cl_uint, const cl_event*) = clEnqueueWaitForEvents;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBuffer_pfn)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*) = clEnqueueWriteBuffer;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteBufferRect_pfn)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*) = clEnqueueWriteBufferRect;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWriteImage_pfn)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*) = clEnqueueWriteImage;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFinish_pfn)(cl_command_queue) = clFinish;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFlush_pfn)(cl_command_queue) = clFlush;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetCommandQueueInfo_pfn)(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*) = clGetCommandQueueInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetContextInfo_pfn)(cl_context, cl_context_info, size_t, void*, size_t*) = clGetContextInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceIDs_pfn)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*) = clGetDeviceIDs;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceInfo_pfn)(cl_device_id, cl_device_info, size_t, void*, size_t*) = clGetDeviceInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventInfo_pfn)(cl_event, cl_event_info, size_t, void*, size_t*) = clGetEventInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventProfilingInfo_pfn)(cl_event, cl_profiling_info, size_t, void*, size_t*) = clGetEventProfilingInfo;
CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddress_pfn)(const char*) = clGetExtensionFunctionAddress;
CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddressForPlatform_pfn)(cl_platform_id, const char*) = clGetExtensionFunctionAddressForPlatform;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetImageInfo_pfn)(cl_mem, cl_image_info, size_t, void*, size_t*) = clGetImageInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelArgInfo_pfn)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void*, size_t*) = clGetKernelArgInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelInfo_pfn)(cl_kernel, cl_kernel_info, size_t, void*, size_t*) = clGetKernelInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelWorkGroupInfo_pfn)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void*, size_t*) = clGetKernelWorkGroupInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetMemObjectInfo_pfn)(cl_mem, cl_mem_info, size_t, void*, size_t*) = clGetMemObjectInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformIDs_pfn)(cl_uint, cl_platform_id*, cl_uint*) = clGetPlatformIDs;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformInfo_pfn)(cl_platform_id, cl_platform_info, size_t, void*, size_t*) = clGetPlatformInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramBuildInfo_pfn)(cl_program, cl_device_id, cl_program_build_info, size_t, void*, size_t*) = clGetProgramBuildInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramInfo_pfn)(cl_program, cl_program_info, size_t, void*, size_t*) = clGetProgramInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSamplerInfo_pfn)(cl_sampler, cl_sampler_info, size_t, void*, size_t*) = clGetSamplerInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSupportedImageFormats_pfn)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format*, cl_uint*) = clGetSupportedImageFormats;
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clLinkProgram_pfn)(cl_context, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, void (CL_CALLBACK*) (cl_program, void*), void*, cl_int*) = clLinkProgram;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseCommandQueue_pfn)(cl_command_queue) = clReleaseCommandQueue;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseContext_pfn)(cl_context) = clReleaseContext;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseDevice_pfn)(cl_device_id) = clReleaseDevice;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseEvent_pfn)(cl_event) = clReleaseEvent;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseKernel_pfn)(cl_kernel) = clReleaseKernel;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseMemObject_pfn)(cl_mem) = clReleaseMemObject;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseProgram_pfn)(cl_program) = clReleaseProgram;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseSampler_pfn)(cl_sampler) = clReleaseSampler;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainCommandQueue_pfn)(cl_command_queue) = clRetainCommandQueue;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainContext_pfn)(cl_context) = clRetainContext;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainDevice_pfn)(cl_device_id) = clRetainDevice;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainEvent_pfn)(cl_event) = clRetainEvent;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainKernel_pfn)(cl_kernel) = clRetainKernel;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainMemObject_pfn)(cl_mem) = clRetainMemObject;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainProgram_pfn)(cl_program) = clRetainProgram;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainSampler_pfn)(cl_sampler) = clRetainSampler;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetEventCallback_pfn)(cl_event, cl_int, void (CL_CALLBACK*) (cl_event, cl_int, void*), void*) = clSetEventCallback;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetKernelArg_pfn)(cl_kernel, cl_uint, size_t, const void*) = clSetKernelArg;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetMemObjectDestructorCallback_pfn)(cl_mem, void (CL_CALLBACK*) (cl_mem, void*), void*) = clSetMemObjectDestructorCallback;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetUserEventStatus_pfn)(cl_event, cl_int) = clSetUserEventStatus;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadCompiler_pfn)() = clUnloadCompiler;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadPlatformCompiler_pfn)(cl_platform_id) = clUnloadPlatformCompiler;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clWaitForEvents_pfn)(cl_uint, const cl_event*) = clWaitForEvents;

@ -0,0 +1,14 @@
//
// AUTOGENERATED, DO NOT EDIT
//
// generated by parser_cl.py
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer_pfn)(cl_context, cl_mem_flags, cl_GLuint, int*) = clCreateFromGLBuffer;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer_pfn)(cl_context, cl_mem_flags, cl_GLuint, cl_int*) = clCreateFromGLRenderbuffer;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture2D;
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture3D;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects_pfn)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*) = clEnqueueAcquireGLObjects;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects_pfn)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*) = clEnqueueReleaseGLObjects;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR_pfn)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*) = clGetGLContextInfoKHR;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo_pfn)(cl_mem, cl_gl_object_type*, cl_GLuint*) = clGetGLObjectInfo;
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo_pfn)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*) = clGetGLTextureInfo;

@ -146,7 +146,6 @@ def getTypeWithParam(t, p):
@outputToString
def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):
print '// generated by %s' % os.path.basename(sys.argv[0])
first = True
for fn in fns:
commentStr = '' if fn.has_key('enabled') else '//'
decl_args = []
@ -162,7 +161,20 @@ def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):
commentStr, enumprefix, fn['name']))
print commentStr + ('static const struct DynamicFnEntry %s_definition = { "%s", (void**)&%s};' % (fn['name'], fn['name'], fn['name']))
print
first = False
@outputToString
def generateStaticDefinitions(fns):
print '// generated by %s' % os.path.basename(sys.argv[0])
for fn in fns:
commentStr = '' if fn.has_key('enabled') else '//'
decl_args = []
for (i, t) in enumerate(fn['params']):
decl_args.append(getTypeWithParam(t, 'p%d' % (i+1)))
decl_args_str = '(' + (', '.join(decl_args)) + ')'
print commentStr + ('CL_RUNTIME_EXPORT %s%s (%s *%s_pfn)(%s) = %s;' % \
((' '.join(fn['modifiers'] + ' ') if len(fn['modifiers']) > 0 else ''),
' '.join(fn['ret']), ' '.join(fn['calling']), fn['name'], ', '.join(fn['params']), \
fn['name']))
@outputToString
def generateListOfDefinitions(fns, name='opencl_fn_list'):
@ -181,9 +193,7 @@ def generateListOfDefinitions(fns, name='opencl_fn_list'):
def generateEnums(fns, prefix='OPENCL_FN'):
print '// generated by %s' % os.path.basename(sys.argv[0])
print 'enum %s_ID {' % prefix
i = -1
for fn in fns:
i = i + 1
for (i, fn) in enumerate(fns):
commentStr = '' if fn.has_key('enabled') else '//'
print commentStr + (' %s_%s = %d,' % (prefix, fn['name'], i))
print '};'
@ -211,9 +221,9 @@ def generateFnDeclaration(fns):
fn['name'], ', '.join(fn['params'] if not fn.has_key('params_full') else fn['params_full'])))
@outputToString
def generateTemplates(sz, lprefix, switch_name, calling_convention=''):
def generateTemplates(total, lprefix, switch_name, calling_convention=''):
print '// generated by %s' % os.path.basename(sys.argv[0])
for sz in range(sz):
for sz in range(total):
template_params = ['ID', '_R', 'decl_args']
params = ['p%d' % (i + 1) for i in range(0, sz)]
print '#define %s%d(%s) \\' % (lprefix, sz, ', '.join(template_params))

@ -1,8 +1,9 @@
#!/bin/bash -e
echo "Generate files for CL runtime..."
python parser_cl.py opencl_core < sources/cl.h
python parser_cl.py opencl_gl < sources/cl_gl.h
python parser_clamdblas.py < sources/clAmdBlas.h
python parser_clamdfft.py < sources/clAmdFft.h
python parser_cl.py opencl_gl < sources/cl_gl.h
echo "Generate files for CL runtime... Done"

@ -11,6 +11,7 @@ try:
module_name = sys.argv[1]
outfile = open('../../../../include/opencv2/core/opencl/runtime/autogenerated/%s.hpp' % module_name, 'wb')
outfile_impl = open('../autogenerated/%s_impl.hpp' % module_name, 'wb')
outfile_static_impl = open('../autogenerated/%s_static_impl.hpp' % module_name, 'wb')
outfile_wrappers = open('../../../../include/opencv2/core/opencl/runtime/autogenerated/%s_wrappers.hpp' % module_name, 'wb')
if len(sys.argv) > 2:
f = open(sys.argv[2], "r")
@ -133,3 +134,6 @@ ctx['CL_NUMBER_OF_ENABLED_FUNCTIONS'] = '// number of enabled functions: %d' % (
sys.stdout = outfile_impl
ProcessTemplate('template/%s_impl.hpp.in' % module_name, ctx)
sys.stdout = outfile_static_impl
ProcessTemplate('template/static_impl.hpp.in', dict(CL_STATIC_DEFINITIONS=generateStaticDefinitions(fns)))

@ -4,7 +4,11 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
@CL_REMAP_DYNAMIC@

@ -4,7 +4,11 @@
@CL_REMAP_ORIGIN@
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
@CL_REMAP_DYNAMIC@

@ -41,10 +41,22 @@
#include "../../precomp.hpp"
#if defined(HAVE_OPENCL) && !defined(HAVE_OPENCL_STATIC)
#if defined(HAVE_OPENCL)
#include "opencv2/core.hpp" // CV_Error
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
CV_SUPPRESS_DEPRECATED_START
#include "autogenerated/opencl_core_static_impl.hpp"
CV_SUPPRESS_DEPRECATED_END
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#else
#include "opencv2/core/opencl/runtime/opencl_core.hpp"
#define OPENCL_FUNC_TO_CHECK_1_1 "clEnqueueReadBufferRect"
@ -205,7 +217,11 @@ static void* opencl_check_fn(int ID);
#define CUSTOM_FUNCTION_ID 1000
#ifdef HAVE_OPENCL_SVM
#endif // HAVE_OPENCL_STATIC
#if defined HAVE_OPENCL_SVM && !defined(HAVE_OPENCL_STATIC)
#include "opencv2/core/opencl/runtime/opencl_svm_20.hpp"
#define SVM_FUNCTION_ID_START CUSTOM_FUNCTION_ID
#define SVM_FUNCTION_ID_END CUSTOM_FUNCTION_ID + 100
@ -269,6 +285,7 @@ static const struct DynamicFnEntry* opencl_svm_fn_list[] = {
// END OF CUSTOM FUNCTIONS HERE
//
#if !defined(HAVE_OPENCL_STATIC)
static void* opencl_check_fn(int ID)
{
const struct DynamicFnEntry* e = NULL;
@ -299,9 +316,26 @@ static void* opencl_check_fn(int ID)
*(e->ppFn) = func;
return func;
}
#endif // HAVE_OPENCL_STATIC
#ifdef HAVE_OPENGL
#if defined(HAVE_OPENCL_STATIC)
#if defined __APPLE__
#include <OpenCL/cl_gl.h>
#else
#include <CL/cl_gl.h>
#endif
#ifdef cl_khr_gl_sharing
CV_SUPPRESS_DEPRECATED_START
#include "autogenerated/opencl_gl_static_impl.hpp"
CV_SUPPRESS_DEPRECATED_END
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
#endif
#else HAVE_OPENCL_STATIC
#include "opencv2/core/opencl/runtime/opencl_gl.hpp"
#ifdef cl_khr_gl_sharing
@ -328,6 +362,8 @@ static void* opencl_gl_check_fn(int ID)
#endif // cl_khr_gl_sharing
#endif // HAVE_OPENCL_STATIC
#endif // HAVE_OPENGL
#endif

Loading…
Cancel
Save