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
cudaGraphicsMapResources
and finally mapped Pointer
cutilSafeCall(cudaGraphicsResourceGetMappedPointer((void **) &par_buffer[i],&num_bytes,par[i]));
resource
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;
__syncthreads();
int i = 256/2;
while (i!=0){
if(cacheIndex<i)
{
cache[cacheIndex]+=cache[cacheIndex+i];
}
__syncthreads();
i/=2;
}
if(cacheIndex ==0)
{
dst[blockIdx.z*gridDim.x*gridDim.y + blockIdx.y*gridDim.x + blockIdx.x] = cache[0];
}
return;
}
postProcessKernel<<<gridDim,blockDim>>>(dev_partial_c,ori_buffer,par_buffer,width,height);