two fast questions:
1] is it possible to allocate dynamically memory in a kernel? (i suppose that the answer is
no and that only constant memory can be allocated at compile time).
2] Suppose you have to write a kernel that scans a gray-level image and store the coordinates of every pixel whose value is > 128. You don't know in advance how many pixel will meet that conditions. So you have to allocate a buffer of W*H*sizeof(pixel), where W is the width of the image, h is the height and pixel is a pod struct:
int x, y;
Is this the only way to pass an output buffer to the kernel?
3] Suppose that you pass to the kernel a buffer object of size K*sizeof(pixel), where K is a parameter decided at run-time (it can be < W*H). Is there a way to say to the kernel: ok, you have to stop know since we does not have enough memory left???