Hi guys,
I’m wondering how to handle arrays of structures correctly in opencl. I have an Triangle structure which contains the three vertices of a triangle. These variables are also structures of Point3D. So my structures look like this:
typedef struct Point3D {
float x, y, z;
} Point3D;
typedef struct Triangle {
Point3D v0, v1, v2; // vertices
} Triangle;
If I use it in the kernel like this:
__kernel testKernel(__global Triangle* triangles) {
Triangle t = triangles[0];
}
the compilation fails and points to a line where no error appears. But if I just get one of the vertices and assign it like
__kernel testKernel(__global Triangle* triangles) {
Point3D p = triangles[0].v0;
}
the compilations doesn’t throw an error. What am I doing wrong?
Thanks in advance
Daniel