Skip to content
Newer
Older
100644 123 lines (78 sloc) 2.58 KB
03e8bc8 @ccgus Plugin for doing fun things with Core Image and OpenCL.
authored
1 //
2 // KBOpenCLProgram.h
3 // KBKit
4 //
5 // Created by Guy English on 09-10-27.
6 // Copyright 2009 Kickingbear. All rights reserved.
7 //
8
9 #import <Cocoa/Cocoa.h>
10
11 #import "JSTOpenCLContext.h"
12
13 @class JSTOpenCLKernel;
14
15 @interface JSTOpenCLProgram : NSObject
16 {
17 JSTOpenCLContext *context;
18 NSString *sourceCode;
19 cl_program computeProgram;
20 NSMutableDictionary *computeKernels;
21 }
22
23 - (id)initWithContext: (JSTOpenCLContext*) theContext;
24
25 @property (readonly) JSTOpenCLContext *context;
26 @property (copy) NSString *sourceCode;
27
28 - (void)build;
29 - (JSTOpenCLKernel*) createKernel: (NSString*) kernelName;
30 - (JSTOpenCLKernel*) kernelWithName: (NSString*) name;
31
32 @end
33
34 @interface JSTOpenCLBuffer : NSObject
35 {
36 JSTOpenCLContext *context;
37 size_t size;
38 cl_bitfield attributes;
39 cl_mem computeBuffer;
40 }
41
42 - (id)initWithContext: (JSTOpenCLContext*) theContext memory: (void*) memory size: (size_t) theSize attributes: (cl_bitfield) theFlags;
43
44 @property (readonly) cl_bitfield attributes;
45 @property (readonly) cl_mem computeBuffer;
46 @property (readonly) size_t size;
47
48 - (void)readToMemory: (void*) array size: (size_t) readSize waitUntilDone: (BOOL) waitFlag;
49
50 @end
51
52
53
54
55 typedef float JSTOCLFloatPixelCo;
56
57 typedef struct _JSTOCLFloatPixel {
58
59 #ifdef __LITTLE_ENDIAN__
60 JSTOCLFloatPixelCo b;
61 JSTOCLFloatPixelCo g;
62 JSTOCLFloatPixelCo r;
63 JSTOCLFloatPixelCo a;
64 #else
65 JSTOCLFloatPixelCo a;
66 JSTOCLFloatPixelCo r;
67 JSTOCLFloatPixelCo g;
68 JSTOCLFloatPixelCo b;
69 #endif
70 } JSTOCLFloatPixel;
71
72
73
74
75
76 @interface JSTOpenCLImageBuffer : JSTOpenCLBuffer {
77
78 size_t _width;
79 size_t _height;
80
81 size_t _bytesPerRow;
82
83 cl_float4 *_bitmapData;
84 }
85
86 @property (readonly) size_t width;
87 @property (readonly) size_t height;
88 @property (readonly) cl_float4 *bitmapData;
89 @property (readonly) size_t bytesPerRow;
90
91 - (id)initWithContext:(JSTOpenCLContext*)theContext width:(size_t)w height:(size_t)h;
92
67e0a5f @ccgus Fun with OpenCL
authored
93 - (id)initWithContext:(JSTOpenCLContext*)theContext usingImageAtPath:(NSString*)path;
94
95
03e8bc8 @ccgus Plugin for doing fun things with Core Image and OpenCL.
authored
96 @end
97
98
99
100
101
102
103 @interface JSTOpenCLKernel : NSObject
104 {
105 JSTOpenCLProgram *program;
106 cl_kernel computeKernel;
107 size_t workGroupSize;
108 }
109
110 - (id)initWithProgram: (JSTOpenCLProgram*) theProgram;
111
112 @property (readonly) cl_kernel computeKernel;
113 @property (readonly) size_t workGroupSize;
114
115 - (void)setArgument: (cl_uint) argIndex size: (size_t) argumentSize value: (void*) value;
116 - (void)setArgument: (cl_uint) argIndex buffer: (JSTOpenCLBuffer*) buffer;
67e0a5f @ccgus Fun with OpenCL
authored
117 - (void)setArgument: (cl_uint) argIndex int:(size_t)v;
118
03e8bc8 @ccgus Plugin for doing fun things with Core Image and OpenCL.
authored
119
120 - (void)enqueueCallWithDimensions: (cl_uint) workDimension globalSizes: (const size_t*) globalWorkSize localSizes: (const size_t*) localWorkSize;
121
122 @end
Something went wrong with that request. Please try again.