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-2021 Sylvain Munaut
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 */
9
10#pragma once
11
12/*! \ingroup cl
13 * @{
14 */
15
16/*! \file cl_compat.h
17 * \brief Handle OpenCL 1.1 <> 1.2 fallback and the related uglyness
18 */
19
20#include "cl_platform.h"
21#include "gl_platform.h"
22
23
24/* Define NVidia specific attributes */
25#ifndef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
26# define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
27# define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
28#endif
29
30
31/* If OpenCL 1.2 isn't supported in the header, add our prototypes */
32#ifndef CL_VERSION_1_2
33
34typedef struct _cl_image_desc {
35 cl_mem_object_type image_type;
43 cl_uint num_samples;
44 cl_mem buffer;
46
47cl_mem CL_API_CALL
48clCreateFromGLTexture(cl_context context,
49 cl_mem_flags flags,
50 GLenum texture_target,
51 GLint miplevel,
52 GLuint texture,
53 cl_int *errcode_ret);
54
55cl_mem CL_API_CALL
56clCreateImage(cl_context context,
57 cl_mem_flags flags,
58 const cl_image_format *image_format,
59 const cl_image_desc *image_desc,
60 void *host_ptr,
61 cl_int *errcode_ret);
62
63cl_int CL_API_CALL
64clEnqueueFillBuffer(cl_command_queue command_queue,
65 cl_mem buffer,
66 const void *pattern,
67 size_t pattern_size,
68 size_t offset,
69 size_t size,
70 cl_uint num_events_in_wait_list,
71 const cl_event *event_wait_list,
72 cl_event *event);
73
74cl_int CL_API_CALL
75clEnqueueFillImage(cl_command_queue command_queue,
76 cl_mem image,
77 const void *fill_color,
78 const size_t *origin,
79 const size_t *region,
80 cl_uint num_events_in_wait_list,
81 const cl_event *event_wait_list,
82 cl_event *event);
83
84#endif
85
86
87/* The actual API */
88void cl_compat_init(void);
89void cl_compat_check_platform(cl_platform_id pl_id);
90
91
92/*! @} */
void cl_compat_init(void)
void cl_compat_check_platform(cl_platform_id pl_id)
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)
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 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)
struct _cl_image_desc cl_image_desc
cl_mem CL_API_CALL clCreateFromGLTexture(cl_context context, cl_mem_flags flags, GLenum texture_target, GLint miplevel, GLuint texture, cl_int *errcode_ret)
Wrapper to select proper OpenCL headers for various platforms.
Wrapper to select proper OpenGL headers for various platforms.
Definition cl_compat.h:34
size_t image_width
Definition cl_compat.h:36
size_t image_height
Definition cl_compat.h:37
cl_uint num_samples
Definition cl_compat.h:43
size_t image_array_size
Definition cl_compat.h:39
cl_uint num_mip_levels
Definition cl_compat.h:42
cl_mem_object_type image_type
Definition cl_compat.h:35
cl_mem buffer
Definition cl_compat.h:44
size_t image_row_pitch
Definition cl_compat.h:40
size_t image_slice_pitch
Definition cl_compat.h:41
size_t image_depth
Definition cl_compat.h:38