Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: exp_jstalk
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 118 lines (76 sloc) 2.494 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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
//
// KBOpenCLProgram.h
// KBKit
//
// Created by Guy English on 09-10-27.
// Copyright 2009 Kickingbear. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "JSTOpenCLContext.h"

@class JSTOpenCLKernel;

@interface JSTOpenCLProgram : NSObject
{
JSTOpenCLContext *context;
NSString *sourceCode;
cl_program computeProgram;
NSMutableDictionary *computeKernels;
}

- (id)initWithContext: (JSTOpenCLContext*) theContext;

@property (readonly) JSTOpenCLContext *context;
@property (copy) NSString *sourceCode;

- (void)build;
- (JSTOpenCLKernel*) createKernel: (NSString*) kernelName;
- (JSTOpenCLKernel*) kernelWithName: (NSString*) name;

@end

@interface JSTOpenCLBuffer : NSObject
{
JSTOpenCLContext *context;
size_t size;
cl_bitfield attributes;
cl_mem computeBuffer;
}

- (id)initWithContext: (JSTOpenCLContext*) theContext memory: (void*) memory size: (size_t) theSize attributes: (cl_bitfield) theFlags;

@property (readonly) cl_bitfield attributes;
@property (readonly) cl_mem computeBuffer;
@property (readonly) size_t size;

- (void)readToMemory: (void*) array size: (size_t) readSize waitUntilDone: (BOOL) waitFlag;

@end




typedef float JSTOCLFloatPixelCo;

typedef struct _JSTOCLFloatPixel {

#ifdef __LITTLE_ENDIAN__
    JSTOCLFloatPixelCo b;
    JSTOCLFloatPixelCo g;
    JSTOCLFloatPixelCo r;
    JSTOCLFloatPixelCo a;
#else
    JSTOCLFloatPixelCo a;
    JSTOCLFloatPixelCo r;
    JSTOCLFloatPixelCo g;
    JSTOCLFloatPixelCo b;
#endif
} JSTOCLFloatPixel;





@interface JSTOpenCLImageBuffer : JSTOpenCLBuffer {
    
    size_t _width;
    size_t _height;
    
    size_t _bytesPerRow;
    
    cl_float4 *_bitmapData;
}

@property (readonly) size_t width;
@property (readonly) size_t height;
@property (readonly) cl_float4 *bitmapData;
@property (readonly) size_t bytesPerRow;

- (id)initWithContext:(JSTOpenCLContext*)theContext width:(size_t)w height:(size_t)h;

@end






@interface JSTOpenCLKernel : NSObject
{
JSTOpenCLProgram *program;
cl_kernel computeKernel;
size_t workGroupSize;
}

- (id)initWithProgram: (JSTOpenCLProgram*) theProgram;

@property (readonly) cl_kernel computeKernel;
@property (readonly) size_t workGroupSize;

- (void)setArgument: (cl_uint) argIndex size: (size_t) argumentSize value: (void*) value;
- (void)setArgument: (cl_uint) argIndex buffer: (JSTOpenCLBuffer*) buffer;

- (void)enqueueCallWithDimensions: (cl_uint) workDimension globalSizes: (const size_t*) globalWorkSize localSizes: (const size_t*) localWorkSize;

@end
Something went wrong with that request. Please try again.