cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

how to pass a complex hierarchical structure to OpenCL

Hi,

I have a raytrace software and would like to implement a part of it with OpenCL.
In order to do this I must pass the entire scene information to OpenCL...

My problem is that it is a complex 'structure/class' hierarchy that use a lot of pointers.

And I don't know an efficient way to pass this scene information to OpenCL.

By example :

struct Scene
{
   Lights * lights;
   InstanceList * instanceList;
}

struct InstanceList
{
    Instance * instance;
    int Count;
}

struct Instance
{
    Geometry * geometry;
    Instance * next;
}

struct Geometry
{
   int GeometryType; // 0 = sphere, 1 = cylinder, 2 = Triangle mesh
   Sphere * sphere;
   Cylinder * cylinder;
   TriangleMesh * triangleMesh;
}

struct TriangleMesh
{
    int[] Indices;
    float[] Vertices;
}


So, with this (simplified) version of the scene, how can I pass this information to openCl and use it ?

Thanks for your help

0 Likes
1 Reply
nou
Exemplar

i think there is only one option. and that every tree pack to array and as pointer use integer index point to this arrays.

i find this SmallLuxGPU

0 Likes