clray

diff src/clray.cc @ 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 41d6253492ad
line diff
     1.1 --- a/src/clray.cc	Mon Jul 12 05:56:47 2010 +0300
     1.2 +++ b/src/clray.cc	Mon Jul 12 07:00:19 2010 +0300
     1.3 @@ -2,6 +2,18 @@
     1.4  #include <assert.h>
     1.5  #include "ocl.h"
     1.6  
     1.7 +struct Sphere {
     1.8 +	cl_float4 pos;
     1.9 +	cl_float radius;
    1.10 +
    1.11 +	cl_float4 color;
    1.12 +} __attribute__((packed));
    1.13 +
    1.14 +struct Ray {
    1.15 +	cl_float4 origin, dir;
    1.16 +} __attribute__((packed));
    1.17 +
    1.18 +
    1.19  int main()
    1.20  {
    1.21  	int data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
    1.22 @@ -17,10 +29,13 @@
    1.23  	if(!prog.load("test.cl")) {
    1.24  		return 1;
    1.25  	}
    1.26 -	if(!prog.set_arg(0, ARG_RD, sizeof data, data)) {
    1.27 +	if(!prog.set_arg_buffer(0, ARG_WR, sizeof res, res)) {
    1.28  		return 1;
    1.29  	}
    1.30 -	if(!prog.set_arg(1, ARG_WR, sizeof res, res)) {
    1.31 +	if(!prog.set_arg_buffer(1, ARG_RD, sizeof data, data)) {
    1.32 +		return 1;
    1.33 +	}
    1.34 +	if(!prog.set_argi(2, 100)) {
    1.35  		return 1;
    1.36  	}
    1.37