Repository navigation
Expand file tree
/
Copy pathCLutil.h
More file actions
73 lines (58 loc) · 2.45 KB
/
Copy pathCLutil.h
File metadata and controls
73 lines (58 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Deathray2 - An Avisynth plug-in filter for spatial/temporal non-local means de-noising.
*
* version 1.00
*
* Copyright 2015, Jawed Ashraf - Deathray@cupidity.f9.co.uk
*/
#ifndef _CL_UTIL_H_
#define _CL_UTIL_H_
#include <string>
using namespace std;
#include <CL/cl.h>
enum result;
// GetCLErrorString
// Returns error message in English
char* GetCLErrorString(
const cl_int &err); // Error number
// GetPlatform
// Finds the first available OpenCL platform
result GetPlatform(
cl_platform_id *platform); // Platform found by OpenCL
// SetContext
// Creates a context solely for GPU devices, setting the
// global variable g_context
result SetContext(
const cl_platform_id &platform); // Platform that requires the new context
// GetDeviceCount
// Requires that g_context is valid
result GetDeviceCount(
int* device_count); // Count of devices found by OpenCL
// GetDeviceList
// Requires that g_context is valid
result GetDeviceList(
cl_device_id** devices); // Array of devices found by OpenCL
// AssembleSources
// Produces a single string containing the text of all the resources
// specified in the input array
result AssembleSources(
const int *resources, // array of resources declared to exist in DLL
const int &resource_count, // count of resources defined within DLL
string *entire_program_source); // source code concatenated from all resources
// CompileAll
// All kernels are compiled, for all available devices.
// Requires g_context and g_devices.
// "include" definitions using the OpenCL compiler's
// -D syntax are applied to the entire source that's compiled
result CompileAll(
const int &device_count, // count of devices in the ...
const cl_device_id &devices, // ... array of devices
const string cl_include); // "include" definitions
// StartOpenCL
// Get OpenCL running, if possible.
// The global array g_devices is configured based on the
// count of devices supplied and all of them are
// targetted for compilation
result StartOpenCL(
int *device_count, // count of devices to configure
const string cl_include); // "include" definitions
#endif // _CL_UTIL_H_