How to pass Array of Graphics Resource Pointer to Kernel

I render multiple picture into PBO in opengl next I want to compare each picture to original picture.

I create

unsigned int * par_buffer[64];

and Map resource using


and finally mapped Pointer

cutilSafeCall(cudaGraphicsResourceGetMappedPointer((void **) &par_buffer[i],&num_bytes,par[i]));


I want to send all of them to Kernel, are there a way ? I have test multiple time but no hope. it seem the memory is not continuous and I always get funny result

Thank In advance !!

this is my lauching code and kernel function

__shared__ float cache[256];

	int x = threadIdx.x + blockIdx.x * blockDim.x;

	int y = threadIdx.y + blockIdx.y * blockDim.y;

	int z = blockIdx.z;

	if(x> imgWidth || y >imgHeight || z > 64) return;

	unsigned int index = y*imgWidth + x ;

	unsigned int cacheIndex= threadIdx.y * blockDim.x + threadIdx.x;

	unsigned int diff = abs((int)(ori[index]-par[z*imgWidth*imgWidth+index]));

	float color = ((float)diff/4294967295.0);

	//dst[index].x = color;

	//dst[index].y = color;

	//dst[index].z = color;

	cache[cacheIndex] = color;



	int i = 256/2;

	while (i!=0){








	if(cacheIndex ==0)


		dst[blockIdx.z*gridDim.x*gridDim.y + blockIdx.y*gridDim.x + blockIdx.x] = cache[0];





I don’t know how to directly solve your problem, but if your main goal is simply to visualize CUDA images easily, you might consider ArrayFire’s graphics functions, which might save you some hassle. Cheers!