Initializing __constants?

  • David Lively
    David Lively

    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?