14#define CL_TARGET_OPENCL_VERSION 220
21#define NUT_CL_FLAG_DIE 0x1
24#define NUT_CL_FLAG_VERBOSE 0x2
28#define NUT_CL_FLAG_MT_SAFE 0x4
32 size_t preferred_work_group_size_multiple;
33 size_t work_group_size;
34 size_t work_item_sizes[];
43 cl_uint num_platforms;
44 cl_platform_id *platform_ids;
46 cl_device_id *device_ids;
47 cl_uint max_compute_units;
48 cl_uint max_work_item_dimensions;
49 size_t max_work_group_size;
50 size_t *max_work_item_sizes;
52 cl_command_queue queue;
53 size_t programs_len, programs_cap;
55 size_t kernels_len, kernels_cap;
57 pthread_mutex_t log_lock;
bool nut_cl_create_kernel(nut_ClMgr *mgr, size_t program_idx, const char *name)
Create one kernel with a given name program_idx should be the index of the program in mgr.
bool nut_cl_make_program_from_source(nut_ClMgr *mgr, const char *source)
Compile OpenCL source read into an OpenCL program The source should come from nut_cl_read_source.
const char * nut_cl_read_source(nut_ClMgr *mgr, const char *filename)
Read an OpenCL source file (.cl) into a string The filename can be any relative path,...
void nut_cl_close(nut_ClMgr *mgr)
Shut down OpenCL and clean up all resources associated with mgr This cleans up all programs,...
bool nut_cl_check_err(nut_ClMgr *mgr, const char *title, const char *subtitle)
Check and report/resolve OpenCL errors after manually calling OpenCL functions Will print errors and/...
bool nut_cl_setup(nut_ClMgr *mgr, int flags)
Initialize OpenCL and store the relevant state in mgr The first available platform and device will be...
bool nut_cl_create_all_kernels(nut_ClMgr *mgr, size_t program_idx)
Create all kernels within a given program Automatically extracts kernel names from the program and ge...
Manages "global" OpenCL state including programs, kernels, the context, and the command queue.