clray

diff src/ocl.h @ 1:0b0e4d18d53f

added non-buffer args
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 12 Jul 2010 07:00:19 +0300
parents 5767277e049f
children deaf85acf6af
line diff
     1.1 --- a/src/ocl.h	Mon Jul 12 05:56:47 2010 +0300
     1.2 +++ b/src/ocl.h	Mon Jul 12 07:00:19 2010 +0300
     1.3 @@ -36,13 +36,32 @@
     1.4  bool write_mem_buffer(CLMemBuffer *mbuf, size_t sz, void *src);
     1.5  bool read_mem_buffer(CLMemBuffer *mbuf, size_t sz, void *dest);
     1.6  
     1.7 +enum {
     1.8 +	ARGTYPE_NONE,
     1.9 +
    1.10 +	ARGTYPE_INT,
    1.11 +	ARGTYPE_FLOAT,
    1.12 +	ARGTYPE_FLOAT4,
    1.13 +	ARGTYPE_MEM_BUF
    1.14 +};
    1.15 +
    1.16 +struct CLArg {
    1.17 +	int type;
    1.18 +	union {
    1.19 +		int ival;
    1.20 +		float fval;
    1.21 +		cl_float4 vval;
    1.22 +		CLMemBuffer *mbuf;
    1.23 +	} v;
    1.24 +};
    1.25 +
    1.26  
    1.27  class CLProgram {
    1.28  private:
    1.29  	std::string kname;
    1.30  	cl_program prog;
    1.31  	cl_kernel kernel;
    1.32 -	std::vector<CLMemBuffer*> mbuf;
    1.33 +	std::vector<CLArg> args;
    1.34  	bool built;
    1.35  
    1.36  public:
    1.37 @@ -51,7 +70,9 @@
    1.38  
    1.39  	bool load(const char *fname);
    1.40  
    1.41 -	bool set_arg(int arg, int rdwr, size_t sz, void *buf);
    1.42 +	bool set_argi(int arg, int val);
    1.43 +	bool set_argf(int arg, float val);
    1.44 +	bool set_arg_buffer(int arg, int rdwr, size_t sz, void *buf);
    1.45  	CLMemBuffer *get_arg_buffer(int arg);
    1.46  
    1.47  	bool build();