AnsweredAssumed Answered

Unable to send the correct cl::Buffer to my kernel !!!

Question asked by spectral on Mar 14, 2012
Latest reply on Mar 15, 2012 by spectral

Hi,

 

I contact you because, since a few days I have a strange bug with my code. What is really strange is that this code is really old and has not changed !

 

So, I send several cl::Buffer to a kernel and when I "print" the values of this buffer, they are completely ugly !

 

Here is the code to send the data :

 

FilmResponse* curve = &FILM_RESPONSE[_controller->FilmResponse];
clBuffer_FilmResponseR = new cl::Buffer(*_context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float) * FILM_RESPONSE_SIZE, (void*)curve->B_R);
//_queue->enqueueWriteBuffer(*_clBuffer_FilmResponseR->GetBuffer(), CL_TRUE, 0, sizeof(float) * FILM_RESPONSE_SIZE, curve->B_R);

_kernel__ToneMapping->setArg(1, *clBuffer_FilmResponseR);

 

Here is the signature of my kernel :

 

__kernel
void kernel__ToneMapping(
          __constant __read_only clFilmSettings* filmSettings,
          __global __read_only float* responseCurveR,
          __global __read_only float* responseCurveG,
          __global __read_only float* responseCurveB, 
          __global uchar4* rgba,
          __global clIBAccumItem* ibAccum,
          int workAmount)

 

What is really strange is that I check the values in curve->B_R before sending it to the kernel... and they are correct, so I suppose that my curve->B_R is not corrupted !

 

I have test this with Intel SDK/NVidia SDK/AMD SDK and I always have this problem. So, it is NOT a SDK bug but something strange is happening on my side :-P

 

Does someone has an idea ?

Outcomes