laobrasuca

array of buffer objects

Discussion created by laobrasuca on Sep 22, 2010
Latest reply on Sep 22, 2010 by n0thing
how to pass it as argument to a kernel

Hi all,

i have a collection of cl_mem buffers which i want to make part of a single kernel execution. what i've done so far was making an array of cl_mem:

cl_mem ArrayOfBuffers = new cl_mem[NumberOfBuffers];

(and create the mem from arrays of floats)

then, i set it as kernel argument like:

clSetKernelArg(kernel, 0, sizeof(cl_mem*), (void *)&ArrayOfBuffers)

However i've a problem when getting it into the kernel, where I have:

__kernel void kernel_job(__global float** Array)

but the compiler crashes with error: kernel arguments can't be declared with types bool/half/pointer-to-pointer. How can i "receive" it into the kernel?

I really want to avoid running one kernel per buffer. The problem is that i have hundreds of buffers, which would mean hundreds of kernel calls, thus lots of overhead.

Outcomes