7 #ifndef Blink_Library_BlinkC_h
8 #define Blink_Library_BlinkC_h
15 #define BLINK_SUCCESS 0
16 #define BLINK_ERROR_ERROR 1
17 #define BLINK_ERROR_OUT_OF_MEMORY 2
18 #define BLINK_ERROR_RUNNING_KERNEL 3
19 #define BLINK_ERROR_PARSING_KERNEL 4
20 #define BLINK_ERROR_COMPILING_KERNEL 5
21 #define BLINK_ERROR_INVALID_IMAGE_SPEC 6
22 #define BLINK_ERROR_DEVICE 7
23 #define BLINK_ERROR_PARAMETER 8
24 #define BLINK_ERROR_INCOMPATIBLE_IMAGES 9
25 #define BLINK_ERROR_INVALID_PROPERTY 10
27 #define BLINK_PROPERTY_NAME 0
30 BLINK_SHARED_API BlinkRef Blink_Retain(BlinkRef ref);
31 BLINK_SHARED_API
void Blink_Release(BlinkRef ref);
33 BLINK_SHARED_API
const char* Blink_Error_GetUserMessage(BlinkErrorRef errorRef);
34 BLINK_SHARED_API BlinkErrorCode Blink_Error_GetStringProperty(BlinkErrorRef errorRef, BlinkErrorProperty property,
const char**
string);
35 BLINK_SHARED_API BlinkErrorCode Blink_Error_GetIntProperty(BlinkErrorRef errorRef, BlinkErrorProperty property,
int* value);
37 BLINK_SHARED_API BlinkErrorCode Blink_Device_CurrentCPUDevice(BlinkRef* pRef, BlinkErrorRef* optionalErrorDesc);
38 BLINK_SHARED_API BlinkErrorCode Blink_Device_CurrentGPUDevice(BlinkRef* pRef, BlinkErrorRef* optionalErrorDesc);
39 BLINK_SHARED_API BlinkErrorCode Blink_Device_DeviceWithID(BlinkRef* pRef, BlinkComputeDeviceID
id, BlinkErrorRef* optionalErrorDesc);
41 BLINK_SHARED_API BlinkErrorCode Blink_Device_Available(BlinkRef device,
char* value, BlinkErrorRef* optionalErrorDesc);
43 BLINK_SHARED_API BlinkErrorCode Blink_Device_Bind(BlinkRef* pRef, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
45 BLINK_SHARED_API BlinkErrorCode Blink_Device_GetProperty(BlinkRef device, BlinkPropertyType type,
void* data,
int* size, BlinkErrorRef* optionalErrorDesc);
47 BLINK_SHARED_API BlinkErrorCode Blink_Image_CreateEmptyImage(BlinkRef* pRef, BlinkErrorRef* optionalErrorDesc);
48 BLINK_SHARED_API BlinkErrorCode Blink_Image_CreateImage(BlinkRef* pRef,
const struct BlinkImageInfo* imageInfo, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
49 BLINK_SHARED_API BlinkErrorCode Blink_Image_ImageForDeviceMemory(BlinkRef* pRef,
const struct BlinkDeviceMemory* deviceMemory,
const struct BlinkImageInfo* imageInfo,
const struct BlinkBufferDesc* layout, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
51 BLINK_SHARED_API BlinkErrorCode Blink_Image_CopyRef(BlinkRef* pRef, BlinkRef src, BlinkErrorRef* optionalErrorDesc);
52 BLINK_SHARED_API BlinkErrorCode Blink_Image_DistributeTo(BlinkRef* pRef, BlinkRef src, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
53 BLINK_SHARED_API BlinkErrorCode Blink_Image_MakeLike(BlinkRef* pRef, BlinkRef src, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
54 BLINK_SHARED_API BlinkErrorCode Blink_Image_Info(BlinkRef image,
struct BlinkImageInfo* info, BlinkErrorRef* optionalErrorDesc);
55 BLINK_SHARED_API BlinkErrorCode Blink_Image_Clear(BlinkRef image, BlinkErrorRef* optionalErrorDesc);
56 BLINK_SHARED_API BlinkErrorCode Blink_Image_IsEmpty(BlinkRef image,
char* result, BlinkErrorRef* optionalErrorDesc);
57 BLINK_SHARED_API BlinkErrorCode Blink_Image_CopyFrom(BlinkRef dst, BlinkRef src, BlinkErrorRef* optionalErrorDesc);
59 BLINK_SHARED_API BlinkErrorCode Blink_Image_CopyFromBuffer(BlinkRef dst,
const void* src,
const struct BlinkBufferDesc* bufferDesc, BlinkErrorRef* optionalErrorDesc);
60 BLINK_SHARED_API BlinkErrorCode Blink_Image_CopyToBuffer(BlinkRef src,
void* dst,
const struct BlinkBufferDesc* bufferDesc, BlinkErrorRef* optionalErrorDesc);
63 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_Make(BlinkRef* pRef, BlinkRef programSource, BlinkErrorRef* optionalErrorDesc);
64 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_GetKernelInfo(BlinkRef ref,
struct BlinkKernelInfo *kInfo, BlinkErrorRef* optionalErrorDesc);
65 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_GetNumImages(BlinkRef ref,
unsigned* nImgs, BlinkErrorRef* optionalErrorDesc);
66 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_GetNumParameters(BlinkRef ref,
unsigned* nParams, BlinkErrorRef* optionalErrorDesc);
67 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_GetImageInfo(BlinkRef ref,
unsigned index,
struct BlinkKernelImageInfo *imgInfo, BlinkErrorRef* optionalErrorDesc);
68 BLINK_SHARED_API BlinkErrorCode Blink_IKernel_GetParameterInfo(BlinkRef ref,
unsigned index,
struct BlinkKernelParameterInfo *paramInfo, BlinkErrorRef* optionalErrorDesc);
70 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_Make(BlinkRef* pRef, BlinkRef programSource, BlinkRef dev, BlinkRef* images,
int nImages, BlinkCodegenFlags flags, BlinkErrorRef* optionalErrorDesc);
72 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_SetIntParam(BlinkRef ref,
const char* name,
const int* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
73 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_SetFloatParam(BlinkRef ref,
const char* name,
const float* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
74 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_SetBoolParam(BlinkRef ref,
const char* name,
const char* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
76 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_GetIntParam(BlinkRef ref,
const char* name,
int* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
77 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_GetFloatParam(BlinkRef ref,
const char* name,
float* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
78 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_GetBoolParam(BlinkRef ref,
const char* name,
char* values,
int nValues, BlinkErrorRef* optionalErrorDesc);
80 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_GetNumInputRanges(BlinkRef ref,
unsigned int *count, BlinkErrorRef *optionalErrorDesc);
81 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_GetInputRanges(BlinkRef ref,
struct BlinkImageAccessDesc *accessDescs,
unsigned int maxDescs, BlinkErrorRef *optionalErrorDesc);
83 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_Iterate(BlinkRef ref, BlinkErrorRef* optionalErrorDesc);
84 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_IterateWithController(BlinkRef ref,
const struct BlinkKernelIterationController* controller, BlinkErrorRef* optionalErrorDesc);
86 BLINK_SHARED_API BlinkErrorCode Blink_ProgramSource_Make(BlinkRef* pRef,
const char* source, BlinkErrorRef* optionalErrorDesc);
90 BLINK_SHARED_API BlinkErrorCode Blink_Add_Precompiled_Kernel(
const char* key,
91 const void* targetCodeData,
92 int targetCodeCompressedSize,
93 int targetCodeUncompressedSize,
94 const void* sharedLibData,
95 int sharedLibCompressedSize,
96 int sharedLibUncompressedSize,
97 const void* execInfoData,
Definitions required for building with the Blink API.
Definition: BlinkTypes.h:84
Definition: BlinkTypes.h:141
Definition: BlinkTypes.h:117
General information about a kernel.
Definition: BlinkTypes.h:104
Definition: BlinkTypes.h:90
Image iteration description.
Definition: BlinkTypes.h:76
Image description.
Definition: BlinkTypes.h:67
Definition: BlinkTypes.h:131
Defines some types used by the Blink API.