Skip to content

Commit 44b75eb

Browse files
committed
core: fix OpenCL runtime compilation with HAVE_OPENCL_STATIC
1 parent d25cbaa commit 44b75eb

File tree

14 files changed

+184
-38
lines changed

14 files changed

+184
-38
lines changed

modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_core.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@
9595
#define clUnloadPlatformCompiler clUnloadPlatformCompiler_
9696
#define clWaitForEvents clWaitForEvents_
9797

98+
#if defined __APPLE__
99+
#include <OpenCL/cl.h>
100+
#else
98101
#include <CL/cl.h>
102+
#endif
99103

100104
// generated by parser_cl.py
101105
#undef clBuildProgram

modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
#define clGetGLObjectInfo clGetGLObjectInfo_
1818
#define clGetGLTextureInfo clGetGLTextureInfo_
1919

20+
#if defined __APPLE__
21+
#include <OpenCL/cl_gl.h>
22+
#else
2023
#include <CL/cl_gl.h>
24+
#endif
2125

2226
// generated by parser_cl.py
2327
#undef clCreateFromGLBuffer

modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@
4444

4545
#ifdef HAVE_OPENCL
4646

47-
#if defined(HAVE_OPENCL_STATIC)
48-
49-
#if defined __APPLE__
50-
#include <OpenCL/cl.h>
51-
#else
52-
#include <CL/cl.h>
53-
#endif
54-
55-
#else // HAVE_OPENCL_STATIC
56-
5747
#ifndef CL_RUNTIME_EXPORT
5848
#if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE)
5949
#define CL_RUNTIME_EXPORT __declspec(dllimport)
@@ -76,8 +66,6 @@
7666

7767
#include "autogenerated/opencl_core.hpp"
7868

79-
#endif // HAVE_OPENCL_STATIC
80-
8169
#ifndef CL_DEVICE_DOUBLE_FP_CONFIG
8270
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
8371
#endif

modules/core/include/opencv2/core/opencl/runtime/opencl_gl.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,8 @@
4646

4747
#include "opencl_core.hpp"
4848

49-
#if defined(HAVE_OPENCL_STATIC)
50-
51-
#if defined __APPLE__
52-
#include <OpenCL/cl_gl.h>
53-
#else
54-
#include <CL/cl_gl.h>
55-
#endif
56-
57-
#else // HAVE_OPENCL_STATIC
58-
5949
#include "autogenerated/opencl_gl.hpp"
6050

61-
#endif // HAVE_OPENCL_STATIC
62-
6351
#endif // defined HAVE_OPENCL && defined HAVE_OPENGL
6452

6553
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP

modules/core/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#include "opencl_svm_definitions.hpp"
1010

11-
#ifndef HAVE_OPENCL_STATIC
12-
1311
#undef clSVMAlloc
1412
#define clSVMAlloc clSVMAlloc_pfn
1513
#undef clSVMFree
@@ -45,8 +43,6 @@ extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue
4543
extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr,
4644
cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event);
4745

48-
#endif // HAVE_OPENCL_STATIC
49-
5046
#endif // HAVE_OPENCL_SVM
5147

5248
#endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
//
2+
// AUTOGENERATED, DO NOT EDIT
3+
//
4+
// generated by parser_cl.py
5+
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;
6+
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;
7+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateBuffer_pfn)(cl_context, cl_mem_flags, size_t, void*, cl_int*) = clCreateBuffer;
8+
CL_RUNTIME_EXPORT cl_command_queue (CL_API_CALL*clCreateCommandQueue_pfn)(cl_context, cl_device_id, cl_command_queue_properties, cl_int*) = clCreateCommandQueue;
9+
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;
10+
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;
11+
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;
12+
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;
13+
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;
14+
CL_RUNTIME_EXPORT cl_kernel (CL_API_CALL*clCreateKernel_pfn)(cl_program, const char*, cl_int*) = clCreateKernel;
15+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clCreateKernelsInProgram_pfn)(cl_program, cl_uint, cl_kernel*, cl_uint*) = clCreateKernelsInProgram;
16+
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;
17+
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithBuiltInKernels_pfn)(cl_context, cl_uint, const cl_device_id*, const char*, cl_int*) = clCreateProgramWithBuiltInKernels;
18+
CL_RUNTIME_EXPORT cl_program (CL_API_CALL*clCreateProgramWithSource_pfn)(cl_context, cl_uint, const char**, const size_t*, cl_int*) = clCreateProgramWithSource;
19+
CL_RUNTIME_EXPORT cl_sampler (CL_API_CALL*clCreateSampler_pfn)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*) = clCreateSampler;
20+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateSubBuffer_pfn)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*) = clCreateSubBuffer;
21+
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;
22+
CL_RUNTIME_EXPORT cl_event (CL_API_CALL*clCreateUserEvent_pfn)(cl_context, cl_int*) = clCreateUserEvent;
23+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrier_pfn)(cl_command_queue) = clEnqueueBarrier;
24+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueBarrierWithWaitList_pfn)(cl_command_queue, cl_uint, const cl_event*, cl_event*) = clEnqueueBarrierWithWaitList;
25+
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;
26+
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;
27+
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;
28+
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;
29+
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;
30+
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;
31+
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;
32+
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;
33+
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;
34+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarker_pfn)(cl_command_queue, cl_event*) = clEnqueueMarker;
35+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueMarkerWithWaitList_pfn)(cl_command_queue, cl_uint, const cl_event*, cl_event*) = clEnqueueMarkerWithWaitList;
36+
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;
37+
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;
38+
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;
39+
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;
40+
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;
41+
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;
42+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueTask_pfn)(cl_command_queue, cl_kernel, cl_uint, const cl_event*, cl_event*) = clEnqueueTask;
43+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueUnmapMemObject_pfn)(cl_command_queue, cl_mem, void*, cl_uint, const cl_event*, cl_event*) = clEnqueueUnmapMemObject;
44+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueWaitForEvents_pfn)(cl_command_queue, cl_uint, const cl_event*) = clEnqueueWaitForEvents;
45+
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;
46+
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;
47+
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;
48+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFinish_pfn)(cl_command_queue) = clFinish;
49+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clFlush_pfn)(cl_command_queue) = clFlush;
50+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetCommandQueueInfo_pfn)(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*) = clGetCommandQueueInfo;
51+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetContextInfo_pfn)(cl_context, cl_context_info, size_t, void*, size_t*) = clGetContextInfo;
52+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceIDs_pfn)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*) = clGetDeviceIDs;
53+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetDeviceInfo_pfn)(cl_device_id, cl_device_info, size_t, void*, size_t*) = clGetDeviceInfo;
54+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventInfo_pfn)(cl_event, cl_event_info, size_t, void*, size_t*) = clGetEventInfo;
55+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetEventProfilingInfo_pfn)(cl_event, cl_profiling_info, size_t, void*, size_t*) = clGetEventProfilingInfo;
56+
CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddress_pfn)(const char*) = clGetExtensionFunctionAddress;
57+
CL_RUNTIME_EXPORT void* (CL_API_CALL*clGetExtensionFunctionAddressForPlatform_pfn)(cl_platform_id, const char*) = clGetExtensionFunctionAddressForPlatform;
58+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetImageInfo_pfn)(cl_mem, cl_image_info, size_t, void*, size_t*) = clGetImageInfo;
59+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelArgInfo_pfn)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void*, size_t*) = clGetKernelArgInfo;
60+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetKernelInfo_pfn)(cl_kernel, cl_kernel_info, size_t, void*, size_t*) = clGetKernelInfo;
61+
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;
62+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetMemObjectInfo_pfn)(cl_mem, cl_mem_info, size_t, void*, size_t*) = clGetMemObjectInfo;
63+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformIDs_pfn)(cl_uint, cl_platform_id*, cl_uint*) = clGetPlatformIDs;
64+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetPlatformInfo_pfn)(cl_platform_id, cl_platform_info, size_t, void*, size_t*) = clGetPlatformInfo;
65+
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;
66+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetProgramInfo_pfn)(cl_program, cl_program_info, size_t, void*, size_t*) = clGetProgramInfo;
67+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetSamplerInfo_pfn)(cl_sampler, cl_sampler_info, size_t, void*, size_t*) = clGetSamplerInfo;
68+
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;
69+
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;
70+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseCommandQueue_pfn)(cl_command_queue) = clReleaseCommandQueue;
71+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseContext_pfn)(cl_context) = clReleaseContext;
72+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseDevice_pfn)(cl_device_id) = clReleaseDevice;
73+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseEvent_pfn)(cl_event) = clReleaseEvent;
74+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseKernel_pfn)(cl_kernel) = clReleaseKernel;
75+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseMemObject_pfn)(cl_mem) = clReleaseMemObject;
76+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseProgram_pfn)(cl_program) = clReleaseProgram;
77+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clReleaseSampler_pfn)(cl_sampler) = clReleaseSampler;
78+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainCommandQueue_pfn)(cl_command_queue) = clRetainCommandQueue;
79+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainContext_pfn)(cl_context) = clRetainContext;
80+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainDevice_pfn)(cl_device_id) = clRetainDevice;
81+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainEvent_pfn)(cl_event) = clRetainEvent;
82+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainKernel_pfn)(cl_kernel) = clRetainKernel;
83+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainMemObject_pfn)(cl_mem) = clRetainMemObject;
84+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainProgram_pfn)(cl_program) = clRetainProgram;
85+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clRetainSampler_pfn)(cl_sampler) = clRetainSampler;
86+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetEventCallback_pfn)(cl_event, cl_int, void (CL_CALLBACK*) (cl_event, cl_int, void*), void*) = clSetEventCallback;
87+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetKernelArg_pfn)(cl_kernel, cl_uint, size_t, const void*) = clSetKernelArg;
88+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetMemObjectDestructorCallback_pfn)(cl_mem, void (CL_CALLBACK*) (cl_mem, void*), void*) = clSetMemObjectDestructorCallback;
89+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clSetUserEventStatus_pfn)(cl_event, cl_int) = clSetUserEventStatus;
90+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadCompiler_pfn)() = clUnloadCompiler;
91+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clUnloadPlatformCompiler_pfn)(cl_platform_id) = clUnloadPlatformCompiler;
92+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clWaitForEvents_pfn)(cl_uint, const cl_event*) = clWaitForEvents;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// AUTOGENERATED, DO NOT EDIT
3+
//
4+
// generated by parser_cl.py
5+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer_pfn)(cl_context, cl_mem_flags, cl_GLuint, int*) = clCreateFromGLBuffer;
6+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer_pfn)(cl_context, cl_mem_flags, cl_GLuint, cl_int*) = clCreateFromGLRenderbuffer;
7+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture;
8+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture2D;
9+
CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D_pfn)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*) = clCreateFromGLTexture3D;
10+
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;
11+
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;
12+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR_pfn)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*) = clGetGLContextInfoKHR;
13+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo_pfn)(cl_mem, cl_gl_object_type*, cl_GLuint*) = clGetGLObjectInfo;
14+
CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo_pfn)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*) = clGetGLTextureInfo;

modules/core/src/opencl/runtime/generator/common.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def getTypeWithParam(t, p):
146146
@outputToString
147147
def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):
148148
print '// generated by %s' % os.path.basename(sys.argv[0])
149-
first = True
150149
for fn in fns:
151150
commentStr = '' if fn.has_key('enabled') else '//'
152151
decl_args = []
@@ -162,7 +161,20 @@ def generateStructDefinitions(fns, lprefix='opencl_fn', enumprefix='OPENCL_FN'):
162161
commentStr, enumprefix, fn['name']))
163162
print commentStr + ('static const struct DynamicFnEntry %s_definition = { "%s", (void**)&%s};' % (fn['name'], fn['name'], fn['name']))
164163
print
165-
first = False
164+
165+
@outputToString
166+
def generateStaticDefinitions(fns):
167+
print '// generated by %s' % os.path.basename(sys.argv[0])
168+
for fn in fns:
169+
commentStr = '' if fn.has_key('enabled') else '//'
170+
decl_args = []
171+
for (i, t) in enumerate(fn['params']):
172+
decl_args.append(getTypeWithParam(t, 'p%d' % (i+1)))
173+
decl_args_str = '(' + (', '.join(decl_args)) + ')'
174+
print commentStr + ('CL_RUNTIME_EXPORT %s%s (%s *%s_pfn)(%s) = %s;' % \
175+
((' '.join(fn['modifiers'] + ' ') if len(fn['modifiers']) > 0 else ''),
176+
' '.join(fn['ret']), ' '.join(fn['calling']), fn['name'], ', '.join(fn['params']), \
177+
fn['name']))
166178

167179
@outputToString
168180
def generateListOfDefinitions(fns, name='opencl_fn_list'):
@@ -181,9 +193,7 @@ def generateListOfDefinitions(fns, name='opencl_fn_list'):
181193
def generateEnums(fns, prefix='OPENCL_FN'):
182194
print '// generated by %s' % os.path.basename(sys.argv[0])
183195
print 'enum %s_ID {' % prefix
184-
i = -1
185-
for fn in fns:
186-
i = i + 1
196+
for (i, fn) in enumerate(fns):
187197
commentStr = '' if fn.has_key('enabled') else '//'
188198
print commentStr + (' %s_%s = %d,' % (prefix, fn['name'], i))
189199
print '};'
@@ -211,9 +221,9 @@ def generateFnDeclaration(fns):
211221
fn['name'], ', '.join(fn['params'] if not fn.has_key('params_full') else fn['params_full'])))
212222

213223
@outputToString
214-
def generateTemplates(sz, lprefix, switch_name, calling_convention=''):
224+
def generateTemplates(total, lprefix, switch_name, calling_convention=''):
215225
print '// generated by %s' % os.path.basename(sys.argv[0])
216-
for sz in range(sz):
226+
for sz in range(total):
217227
template_params = ['ID', '_R', 'decl_args']
218228
params = ['p%d' % (i + 1) for i in range(0, sz)]
219229
print '#define %s%d(%s) \\' % (lprefix, sz, ', '.join(template_params))
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash -e
22
echo "Generate files for CL runtime..."
33
python parser_cl.py opencl_core < sources/cl.h
4+
python parser_cl.py opencl_gl < sources/cl_gl.h
5+
46
python parser_clamdblas.py < sources/clAmdBlas.h
57
python parser_clamdfft.py < sources/clAmdFft.h
68

7-
python parser_cl.py opencl_gl < sources/cl_gl.h
89
echo "Generate files for CL runtime... Done"

0 commit comments

Comments
 (0)