Initializing __constants?

Help
2011-08-21
2012-12-21
  • David Lively
    David Lively
    2011-08-21

    I have some general parameters declared as a global (__constant) struct, like so:

    typedef struct
    {
    int a;
    int b;
    float c;
    /// blah blah

    } SomeParams;

    __constant SomeParams Parameters;

    in the kernel, I need to use it like so:

    __kernel void Foo()
    {
    int a = Parameters.a;
    /// do something useful…
    }

    I'm not sure how I can initialize the value of Parameters. I have no problem creating buffers, etc for kernel arguments, but since this isn't a kernel argument, what do I need to do?