marcinkr's picture

OpenCl array inside a struct

I have been having problem sending a relatively simple structure to GPU:

public struct Structure
   /*some other Vectors, floats or integers*/
    public float[] Array;

Corresponding Cl code:

struct __attribute__ ((packed)) Structure
    /*as before*/
    float4 Transform[4];

And while I have no problem with converting Vectors to float4, I have no idea how to proceed with fixed-size arrays.

GCHandle.Alloc(data, GCHandleType.Pinned);

throws an exception, saying that object has wrong data.

Any help?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nythrix's picture
marcinkr's picture

Great, that's working :)