Blink API
BlinkC.h
Go to the documentation of this file.
1 // Copyright (c) 2013 The Foundry Visionmongers Ltd. All Rights Reserved.
2 
7 #ifndef Blink_Library_BlinkC_h
8 #define Blink_Library_BlinkC_h
9 #include "BlinkBuild.h"
10 #include "BlinkTypes.h"
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
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
26 
27 #define BLINK_PROPERTY_NAME 0
28 
29 
30 BLINK_SHARED_API BlinkRef Blink_Retain(BlinkRef ref);
31 BLINK_SHARED_API void Blink_Release(BlinkRef ref);
32 
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);
36 
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);
40 
41 BLINK_SHARED_API BlinkErrorCode Blink_Device_Available(BlinkRef device, char* value, BlinkErrorRef* optionalErrorDesc);
42 
43 BLINK_SHARED_API BlinkErrorCode Blink_Device_Bind(BlinkRef* pRef, BlinkRef device, BlinkErrorRef* optionalErrorDesc);
44 
45 BLINK_SHARED_API BlinkErrorCode Blink_Device_GetProperty(BlinkRef device, BlinkPropertyType type, void* data, int* size, BlinkErrorRef* optionalErrorDesc);
46 
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);
50 
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);
58 
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);
61 
62 
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);
69 
70 BLINK_SHARED_API BlinkErrorCode Blink_Kernel_Make(BlinkRef* pRef, BlinkRef programSource, BlinkRef dev, BlinkRef* images, int nImages, BlinkCodegenFlags flags, BlinkErrorRef* optionalErrorDesc);
71 
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);
75 
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);
79 
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);
82 
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);
85 
86 BLINK_SHARED_API BlinkErrorCode Blink_ProgramSource_Make(BlinkRef* pRef, const char* source, BlinkErrorRef* optionalErrorDesc);
87 
88 
89 //This function may change before release.
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,
98  int execInfoSize);
99 
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 #endif
Definitions required for building with the Blink API.
Definition: BlinkTypes.h:88
Definition: BlinkTypes.h:150
Definition: BlinkTypes.h:124
General information about a kernel.
Definition: BlinkTypes.h:110
Definition: BlinkTypes.h:95
Image iteration description.
Definition: BlinkTypes.h:79
Image description.
Definition: BlinkTypes.h:69
Definition: BlinkTypes.h:139
Defines some types used by the Blink API.


©2020 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk