30 #include <nih/bvh/bvh.h> 31 #include <nih/linalg/vector.h> 32 #include <nih/linalg/bbox.h> 33 #include <nih/bintree/bintree_node.h> 34 #include <nih/bintree/cuda/bintree_gen_context.h> 35 #include <thrust/device_vector.h> 40 namespace binned_sah {
47 FORCE_INLINE NIH_HOST_DEVICE int32 get_size()
const {
return binary_cast<int32>( bmin.w ); }
48 FORCE_INLINE NIH_HOST_DEVICE
void set_size(
const int32 x) { bmin.w =
binary_cast<
float>(x); }
52 NIH_HOST_DEVICE
Split() {}
53 NIH_HOST_DEVICE
Split(int32
id, int32 plane) : task_id(
id), best_plane(plane) {}
105 thrust::device_vector<Bvh_node>& nodes,
106 thrust::device_vector<uint2>& leaves,
107 thrust::device_vector<uint32>& index) :
108 m_nodes( &nodes ), m_leaves( &leaves ), m_index( &index )
110 m_init_bins_time = 0.0f;
111 m_update_bins_time = 0.0f;
112 m_sah_split_time = 0.0f;
113 m_distribute_objects_time = 0.0f;
124 template <
typename Iterator>
128 const Iterator bbox_begin,
129 const Iterator bbox_end,
130 const Iterator h_bbox_begin,
131 const uint32 max_leaf_size,
132 const float max_cost = 1.8f);
134 thrust::device_vector<Bvh_node>* m_nodes;
135 thrust::device_vector<uint2>* m_leaves;
136 thrust::device_vector<uint32>* m_index;
137 uint32 m_levels[128];
138 uint32 m_level_count;
143 float m_init_bins_time;
144 float m_update_bins_time;
145 float m_sah_split_time;
146 float m_distribute_objects_time;
155 thrust::device_vector<float3> m_bin_bmin;
156 thrust::device_vector<float3> m_bin_bmax;
157 thrust::device_vector<int32> m_bin_size;
158 thrust::device_vector<Bin> m_queue_bins;
159 thrust::device_vector<Split> m_queue_splits;
160 thrust::device_vector<uint32> m_queue_offsets;
162 thrust::device_vector<int4> m_bin_ids;
163 thrust::device_vector<int32> m_split_ids;
164 thrust::device_vector<int32> m_node_ids;
165 thrust::device_vector<uint32> m_new_pos;
166 thrust::device_vector<uint32> m_counters;
175 #include <nih/bvh/cuda/binned_sah_builder_inline.h> Definition: binned_sah_builder.h:65
Definition: binned_sah_builder.h:72
Definition: binned_sah_builder.h:50
Definition: sah_builder.h:37
Definition: binned_sah_builder.h:97
Definition: binned_sah_builder.h:42
Binned_sah_builder(thrust::device_vector< Bvh_node > &nodes, thrust::device_vector< uint2 > &leaves, thrust::device_vector< uint32 > &index)
Definition: binned_sah_builder.h:104
Definition: binned_sah_builder.h:58
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Out binary_cast(const In in)
Definition: types.h:288
Definition: binned_sah_builder.h:77