3 Replies Latest reply on Jul 21, 2016 2:41 AM by dipak

    OpenCL newbie question


      I am trying to use the openCL examples in DirectGMA SDK 1.1.  Although in general it seems to be working, but I am finding weird behaviours when I try to change the OpenCL kernel code, so I would appreciate some feedback.  I get no error message (basically it seems the kernel is compiled fine, and the code runs, but I don't get any correct output either.


      // Modified kernel code

          const char* pKernelSrc = "__kernel void copyImage(__global uint* rgbaIn, __global uint* rgbaOut, int2 vDim)          \n \

                                    {                                                                                         \n \

                                          uint posX = get_global_id(0);                                                       \n \

                                          uint posY = get_global_id(1);                                                       \n \

                                          uint value4 = 0;                                                                    \n \

                                                                                                                              \n \

                                          value4 = rgbaIn[posY] ;                                      \n \

                                          rgbaOut[(posY * (vDim.y)) + posX]  = value4;                                      \n \

                                      } ";




      (1)    If I modify the value4 to
            value4=rgbaIn[posY] + 0xffff ; // this works
            value4=rgbaIn[posY]  & 0xffff  ; //  this doesn't work


      (2) If I modify the input parameter from __global uint * rgbIn to __global uchar* rgbIn,  it doesn't work, even if I typecast it ..
             so value4 = (uint) rgbIn[posY];  //( causes things not to work correctly. kernel compiles fine, just that it seems to be doing nothing)
      (3) assigning constant values seems to break things too,. I tried doing a simple colorfill, but just doing 
           value4 = 0x555555;  // this doesn't wrk either


      I am trying to basically do format conversion with OpenCL. Basically I've 2 cl_mem buffers in GPU memory, and I am doing 16bpp - 32bpp conversion, and copying the results to an OpenGL texture to display. I tried some sample OpenCL code I got from web, but none really behaves really well either. Could this be just that the OpenCL stuff in the DirectGMA 1.1 SDK is too. So far only the enqueueread/write copy works consistently, anything else seems to have very tight requirements. But I am a newbie, so maybe I am missing something. Most of the time the kernel compileswith no issues, it just doesn't work. (if I purposely inject errors in to the kernel, it then it will fail kernel compilation)


      Any help would be much appreciated.