3 Replies Latest reply on Jul 28, 2010 3:43 PM by omkaranathan

    Passing arguments to Kernel

    foofel

      Hi, I am trying to pass a struct from my host program to the Kernel. It looks like this:

      OpenCL:

      typedef struct sampleOptions_t
      {
      float density;
      float transferScale;
      float transferOffset;
      float brightness;
      }SampleOptions;

      Host:

      typedef struct sampleOptions_t
      {
      float density;
      float transferScale;
      float transferOffset;
      float brightness;
      } SampleOptions;

      My Kernel signature looks that way:

       __kernel void Render
      (
      __global uchar4 *out_image ,
      __private float16 invViewMatrix,
      __global uint *volumeImage,
      __private SampleOptions opts,
      __private float4 opts2
      )

      My problem is, that "opts" does not always get the right values. "opts2" (only added for debugging purposes) and "opts" get exactly the same values passed, but it depends on the parameter order order if i get the right values. The upper example does not work, but as soon as i change the signature to

       __kernel void Render
      (
      __global uchar4 *out_image ,
      __private float16 invViewMatrix,
      __global uint *volumeImage ,
      __private float4 opts2,
      __private SampleOptions opts
      )

      it works. I think its an aliasing problem but i cant get it right. Any ideas?

       

      Thanks for reading