   {
     struct TrianglesGenerator : public CubeIndexEstimator
     {
-      enum { CTA_SIZE = 256 };
+      enum { CTA_SIZE = 256, MAX_GRID_SIZE_X = 65536 };
 
       const int* occupied_voxels;
       const int* vertex_ofssets;

      operator () () const
      {
        int tid = threadIdx.x;
        int idx = blockIdx.x * CTA_SIZE + tid;

        if (idx >= voxels_count)
          return;


void
pcl::device::generateTriangles (const PtrStep<short2>& volume, const DeviceArray2D<int>& occupied_voxels, const float3& volume_size, DeviceArray<PointType>& output)
{    
  typedef TrianglesGenerator Tg;
  Tg tg;

  tg.volume = volume;
  tg.occupied_voxels = occupied_voxels.ptr (0);
