1 #ifndef boxm2_multi_update_h 2 #define boxm2_multi_update_h 3 //: 4 // \file 5 #include <boxm2_multi/boxm2_multi_cache.h> 6 #include <boxm2/boxm2_scene.h> 7 #include <boxm2/ocl/boxm2_opencl_cache1.h> 8 #include <boxm2/ocl/boxm2_ocl_util.h> 9 #include <vpgl/vpgl_camera_double_sptr.h> 10 #include <bocl/bocl_device.h> 11 #include <bocl/bocl_kernel.h> 12 #include <bocl/bocl_manager.h> 13 #include <vil/vil_image_view.h> 14 15 //: boxm2_multi_cache - example realization of abstract cache class 16 class boxm2_multi_update 17 { 18 public: 19 typedef vnl_vector_fixed<unsigned char, 16> uchar16; 20 21 //multi render header 22 static float update(boxm2_multi_cache& cache, vil_image_view<float>& img, vpgl_camera_double_sptr cam ); 23 }; 24 25 26 //: Helper class that stores factored out update objects - rays, queues, bit lookup 27 class boxm2_multi_update_helper 28 { 29 public: boxm2_multi_update_helper(std::vector<cl_command_queue> & queues,std::vector<bocl_mem_sptr> & ray_os,std::vector<bocl_mem_sptr> & ray_ds,std::vector<bocl_mem_sptr> & img_dims,std::vector<bocl_mem_sptr> & tnearfarptrs,std::vector<bocl_mem_sptr> & lookups,std::vector<bocl_mem_sptr> & outputs,std::vector<boxm2_multi_cache_group * > & group_orders,std::vector<std::vector<boxm2_block_id>> & vis_orders,std::vector<boxm2_opencl_cache1 * > & vis_caches,std::size_t maxBlocks)30 boxm2_multi_update_helper(std::vector<cl_command_queue>& queues, 31 std::vector<bocl_mem_sptr>& ray_os, 32 std::vector<bocl_mem_sptr>& ray_ds, 33 std::vector<bocl_mem_sptr>& img_dims, 34 std::vector<bocl_mem_sptr>& tnearfarptrs, 35 std::vector<bocl_mem_sptr>& lookups, 36 std::vector<bocl_mem_sptr>& outputs, 37 std::vector<boxm2_multi_cache_group*>& group_orders, 38 std::vector<std::vector<boxm2_block_id> >& vis_orders, 39 std::vector<boxm2_opencl_cache1*>& vis_caches, 40 std::size_t maxBlocks) : 41 queues_(queues), 42 img_dims_(img_dims), 43 tnearfarptrs_(tnearfarptrs), 44 outputs_(outputs), 45 ray_ds_(ray_ds), 46 ray_os_(ray_os), 47 lookups_(lookups), 48 vis_orders_(vis_orders), 49 vis_caches_(vis_caches), 50 maxBlocks_(maxBlocks), 51 group_orders_(group_orders) 52 {} 53 54 //update command queues 55 std::vector<cl_command_queue>& queues_; 56 57 //ray trace vars 58 std::vector<bocl_mem_sptr>& img_dims_, outputs_, ray_ds_, ray_os_, lookups_, tnearfarptrs_; 59 60 //visibility order for each dev 61 std::vector<std::vector<boxm2_block_id> >& vis_orders_; 62 std::vector<boxm2_opencl_cache1*>& vis_caches_; 63 std::size_t maxBlocks_; 64 std::vector<boxm2_multi_cache_group*>& group_orders_; 65 }; 66 67 //: patch helper 68 class boxm2_multi_image_patch 69 { 70 public: boxm2_multi_image_patch(boxm2_block_id id,float * img,std::size_t ni,std::size_t nj,std::size_t oi,std::size_t oj)71 boxm2_multi_image_patch(boxm2_block_id id, 72 float* img, 73 std::size_t ni, std::size_t nj, 74 std::size_t oi, std::size_t oj) 75 : ni_(ni), nj_(nj), oi_(oi), oj_(oj), img_(img), id_(id) {} 76 77 private: 78 std::size_t ni_, nj_, oi_, oj_; 79 float* img_; 80 boxm2_block_id id_; 81 }; 82 83 84 #endif 85