DoItForFree

11-18-2009, 09:27 AM

i have a cl-file causing problems (i have broken it down to the smallest program causing the problem):

unsigned char lookUp(__global unsigned char *pData, unsigned int dimx, unsigned int dimy, unsigned int x, unsigned int y)

{

if ((x < dimx)||(y < dimy))

return(pData[y*dimy+x]);

else

return(0);

}

__kernel void foo(__global unsigned char *pInData, __global unsigned char *pOutData, unsigned int dimx, unsigned int dimy)

{

unsigned int x = (int)get_global_id(0);

unsigned int y = (int)get_global_id(1);

__global unsigned char *pOut = pOutData + row * dimx;

unsigned int sum = 0;

if (x < dimx)&&(y<dimy))

{

sum = ((unsigned int)lookUp(pInData, dimx, dimy, x, y));

sum += ((unsigned int)lookUp(pInData, dimx, dimy, x+1, y));

pOut[x] = (unsigned char)(sum / 2);

}

}

this kernel causes clBuildProgram to return CL_INVALID_BINARY - my question is why?

common syntax errors result in a return value of 1 - as far as i spectated

when deleting the line sum += ((unsigned int)lookUp(pInData, dimx, dimy, x+1, y)); it works

need help ;)

unsigned char lookUp(__global unsigned char *pData, unsigned int dimx, unsigned int dimy, unsigned int x, unsigned int y)

{

if ((x < dimx)||(y < dimy))

return(pData[y*dimy+x]);

else

return(0);

}

__kernel void foo(__global unsigned char *pInData, __global unsigned char *pOutData, unsigned int dimx, unsigned int dimy)

{

unsigned int x = (int)get_global_id(0);

unsigned int y = (int)get_global_id(1);

__global unsigned char *pOut = pOutData + row * dimx;

unsigned int sum = 0;

if (x < dimx)&&(y<dimy))

{

sum = ((unsigned int)lookUp(pInData, dimx, dimy, x, y));

sum += ((unsigned int)lookUp(pInData, dimx, dimy, x+1, y));

pOut[x] = (unsigned char)(sum / 2);

}

}

this kernel causes clBuildProgram to return CL_INVALID_BINARY - my question is why?

common syntax errors result in a return value of 1 - as far as i spectated

when deleting the line sum += ((unsigned int)lookUp(pInData, dimx, dimy, x+1, y)); it works

need help ;)