This project is read-only.

How to pass a structure to the kernel?

May 11, 2014 at 12:15 PM
Edited May 11, 2014 at 12:15 PM
The cuda file and the C# file should know the structure.
Can you write me a simple code that this can be done?
May 11, 2014 at 12:45 PM
Check one of the Fluids-samples. In Cuda part you can find a definition for "Vertex" which is:
typedef unsigned long DWORD;

typedef struct vertex {
    float x, y, z;
    DWORD c;     
} Vertex;
In C# you simply need to redefine a structure having the same layout:
struct vertex
    public float x;
    public float y;
    public float z;
    public uint c;
Then you can use the C#-vertex like any other structure defined in C# and you can use the Cuda-vertex in your kernels.
May 11, 2014 at 12:58 PM
Yes I see it now. Thanks. Its simple. I will create what I want to do in no time.