34 #include <nih/bvh/bvh.h> 35 #include <nih/linalg/vector.h> 36 #include <nih/linalg/bbox.h> 37 #include <nih/bintree/bintree_node.h> 38 #include <nih/bintree/cuda/bintree_gen_context.h> 39 #include <thrust/device_vector.h> 51 FORCE_INLINE NIH_HOST_DEVICE int32 get_size()
const {
return binary_cast<int32>( bmin.w ); }
52 FORCE_INLINE NIH_HOST_DEVICE
void set_size(
const int32 x) { bmin.w =
binary_cast<
float>(x); }
112 thrust::device_vector<Bvh_node>& nodes,
113 thrust::device_vector<uint2>& leaves,
114 thrust::device_vector<uint32>& index) :
115 m_nodes( &nodes ), m_leaves( &leaves ), m_index( &index )
117 m_sorting_time = 0.0f;
118 m_compression_time = 0.0f;
119 m_sah_split_time = 0.0f;
120 m_distribute_objects_time = 0.0f;
132 template <
typename Iterator>
135 const Iterator bbox_begin,
136 const Iterator bbox_end,
137 const uint32 max_leaf_size,
138 const float max_cost = 1.8f);
140 thrust::device_vector<Bvh_node>* m_nodes;
141 thrust::device_vector<uint2>* m_leaves;
142 thrust::device_vector<uint32>* m_index;
143 uint32 m_levels[128];
144 uint32 m_level_count;
148 float m_sorting_time;
149 float m_compression_time;
150 float m_sah_split_time;
151 float m_distribute_objects_time;
152 uint32 m_temp_storage;
156 const uint32 n_objects,
157 thrust::device_vector<uint32>::iterator segment_ids,
158 thrust::device_vector<uint32>::iterator segment_keys,
159 thrust::device_vector<uint2>::iterator in_bounds,
160 thrust::device_vector<uint2>::iterator bounds,
161 thrust::device_vector<uint2>::iterator bounds_tmp,
162 thrust::device_vector<uint32>::iterator order,
163 uint32& n_active_objects,
166 void eval_split_costs(
167 const uint32 n_objects,
168 const uint32 n_segments,
169 thrust::device_vector<uint32>::iterator segment_keys,
170 thrust::device_vector<uint32>::iterator segment_heads,
171 thrust::device_vector<uint2>::iterator bounds,
172 thrust::device_vector<uint2>::iterator bounds_l,
173 thrust::device_vector<uint2>::iterator bounds_r,
174 thrust::device_vector<float>::iterator split_costs,
175 thrust::device_vector<uint32>::iterator split_index);
181 thrust::device_vector<uint32> m_segment_heads;
182 thrust::device_vector<uint32> m_segment_keys;
183 thrust::device_vector<Bin> m_queue_bins[2];
184 thrust::device_vector<uint2> m_scan_bounds;
185 thrust::device_vector<float> m_split_costs;
186 thrust::device_vector<uint32> m_split_index;
188 thrust::device_vector<uint32> m_segment_ids;
189 thrust::device_vector<uint32> m_node_ids;
190 thrust::device_vector<uint32> m_counters;
199 #include <nih/bvh/cuda/sah_builder_inline.h> Sah_builder(thrust::device_vector< Bvh_node > &nodes, thrust::device_vector< uint2 > &leaves, thrust::device_vector< uint32 > &index)
Definition: sah_builder.h:111
Definition: sah_builder.h:37
Definition: sah_builder.h:115
Definition: sah_builder.h:110
Definition: sah_builder.h:46
GPU-based SAH BVH builder.
Definition: sah_builder.h:41
Definition: sah_builder.h:80
Definition: sah_builder.h:59
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Out binary_cast(const In in)
Definition: types.h:288
Definition: sah_builder.h:54