cl_compat.h
Go to the documentation of this file.
/*
* cl_compat.h
*
* Handle OpenCL 1.1 <> 1.2 fallback and the related uglyness
*
* Copyright (C) 2013-2021 Sylvain Munaut
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
/*! \ingroup cl
* @{
*/
/*! \file cl_compat.h
* \brief Handle OpenCL 1.1 <> 1.2 fallback and the related uglyness
*/
#include "cl_platform.h"
#include "gl_platform.h"
/* Define NVidia specific attributes */
#ifndef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
# define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
# define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
#endif
/* If OpenCL 1.2 isn't supported in the header, add our prototypes */
#ifndef CL_VERSION_1_2
typedef struct _cl_image_desc {
cl_mem_object_type image_type;
size_t image_width;
size_t image_height;
size_t image_depth;
size_t image_array_size;
size_t image_row_pitch;
size_t image_slice_pitch;
cl_uint num_mip_levels;
cl_uint num_samples;
cl_mem buffer;
} 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);
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);
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);
#endif
/* The actual API */
void cl_compat_init(void);
void cl_compat_check_platform(cl_platform_id pl_id);
/*! @} */
cl_compat_init
void cl_compat_init(void)
cl_compat_check_platform
void cl_compat_check_platform(cl_platform_id pl_id)
clEnqueueFillImage
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)
clCreateImage
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)
clEnqueueFillBuffer
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_image_desc
struct _cl_image_desc cl_image_desc
clCreateFromGLTexture
cl_mem CL_API_CALL clCreateFromGLTexture(cl_context context, cl_mem_flags flags, GLenum texture_target, GLint miplevel, GLuint texture, cl_int *errcode_ret)
cl_platform.h
Wrapper to select proper OpenCL headers for various platforms.
gl_platform.h
Wrapper to select proper OpenGL headers for various platforms.
_cl_image_desc
Definition: cl_compat.h:34
_cl_image_desc::image_width
size_t image_width
Definition: cl_compat.h:36
_cl_image_desc::image_height
size_t image_height
Definition: cl_compat.h:37
_cl_image_desc::num_samples
cl_uint num_samples
Definition: cl_compat.h:43
_cl_image_desc::image_array_size
size_t image_array_size
Definition: cl_compat.h:39
_cl_image_desc::num_mip_levels
cl_uint num_mip_levels
Definition: cl_compat.h:42
_cl_image_desc::image_type
cl_mem_object_type image_type
Definition: cl_compat.h:35
_cl_image_desc::buffer
cl_mem buffer
Definition: cl_compat.h:44
_cl_image_desc::image_row_pitch
size_t image_row_pitch
Definition: cl_compat.h:40
_cl_image_desc::image_slice_pitch
size_t image_slice_pitch
Definition: cl_compat.h:41
_cl_image_desc::image_depth
size_t image_depth
Definition: cl_compat.h:38