1 Reply Latest reply on Jan 3, 2010 10:33 AM by nou

    how to pass a complex hierarchical structure to OpenCL

    spectral

      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