GNU Radio's TEST Package
cl_compat.h
Go to the documentation of this file.
1 /*
2  * cl_compat.h
3  *
4  * Handle OpenCL 1.1 <> 1.2 fallback and the related uglyness
5  *
6  * Copyright (C) 2013-2014 Sylvain Munaut
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __FOSPHOR_CL_COMPAT_H__
23 #define __FOSPHOR_CL_COMPAT_H__
24 
25 /*! \ingroup cl
26  * @{
27  */
28 
29 /*! \file cl_compat.h
30  * \brief Handle OpenCL 1.1 <> 1.2 fallback and the related uglyness
31  */
32 
33 #include "cl_platform.h"
34 #include "gl_platform.h"
35 
36 
37 /* Define NVidia specific attributes */
38 #ifndef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
39 # define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
40 # define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
41 #endif
42 
43 
44 /* If OpenCL 1.2 isn't supported in the header, add our prototypes */
45 #ifndef CL_VERSION_1_2
46 
47 typedef struct _cl_image_desc {
48  cl_mem_object_type image_type;
49  size_t image_width;
50  size_t image_height;
51  size_t image_depth;
55  cl_uint num_mip_levels;
56  cl_uint num_samples;
57  cl_mem buffer;
59 
60 cl_mem CL_API_CALL
61 clCreateFromGLTexture(cl_context context,
62  cl_mem_flags flags,
63  GLenum texture_target,
64  GLint miplevel,
65  GLuint texture,
66  cl_int *errcode_ret);
67 
68 cl_mem CL_API_CALL
69 clCreateImage(cl_context context,
70  cl_mem_flags flags,
71  const cl_image_format *image_format,
72  const cl_image_desc *image_desc,
73  void *host_ptr,
74  cl_int *errcode_ret);
75 
76 cl_int CL_API_CALL
77 clEnqueueFillBuffer(cl_command_queue command_queue,
78  cl_mem buffer,
79  const void *pattern,
80  size_t pattern_size,
81  size_t offset,
82  size_t size,
83  cl_uint num_events_in_wait_list,
84  const cl_event *event_wait_list,
85  cl_event *event);
86 
87 cl_int CL_API_CALL
88 clEnqueueFillImage(cl_command_queue command_queue,
89  cl_mem image,
90  const void *fill_color,
91  const size_t *origin,
92  const size_t *region,
93  cl_uint num_events_in_wait_list,
94  const cl_event *event_wait_list,
95  cl_event *event);
96 
97 #endif
98 
99 
100 /* The actual API */
101 void cl_compat_init(void);
102 void cl_compat_check_platform(cl_platform_id pl_id);
103 
104 
105 /*! @} */
106 
107 #endif /* __FOSPHOR_CL_COMPAT_H__ */
size_t image_depth
Definition: cl_compat.h:51
size_t image_array_size
Definition: cl_compat.h:52
cl_mem CL_API_CALL clCreateImage(cl_context context, cl_mem_flags flags, const cl_image_format *image_format, const cl_image_desc *image_desc, void *host_ptr, cl_int *errcode_ret)
cl_int CL_API_CALL clEnqueueFillImage(cl_command_queue command_queue, cl_mem image, const void *fill_color, const size_t *origin, const size_t *region, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
void cl_compat_check_platform(cl_platform_id pl_id)
Wrapper to select proper OpenCL headers for various platforms.
Wrapper to select proper OpenGL headers for various platforms.
size_t image_row_pitch
Definition: cl_compat.h:53
Definition: cl_compat.h:47
cl_int CL_API_CALL clEnqueueFillBuffer(cl_command_queue command_queue, cl_mem buffer, const void *pattern, size_t pattern_size, size_t offset, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
cl_uint num_samples
Definition: cl_compat.h:56
cl_uint num_mip_levels
Definition: cl_compat.h:55
struct _cl_image_desc cl_image_desc
cl_mem buffer
Definition: cl_compat.h:57
cl_mem CL_API_CALL clCreateFromGLTexture(cl_context context, cl_mem_flags flags, GLenum texture_target, GLint miplevel, GLuint texture, cl_int *errcode_ret)
size_t image_width
Definition: cl_compat.h:49
void cl_compat_init(void)
size_t image_height
Definition: cl_compat.h:50
cl_mem_object_type image_type
Definition: cl_compat.h:48
size_t image_slice_pitch
Definition: cl_compat.h:54