24 template<
class u_morton>
25 void TreeStructure<u_morton>::build(
26 sycl::queue &queue,
u32 _internal_cell_count, sycl::buffer<u_morton> &morton_buf) {
28 if (!(_internal_cell_count < morton_buf.size())) {
30 "morton buf must be at least with size() greater than internal_cell_count");
33 internal_cell_count = _internal_cell_count;
35 buf_lchild_id = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
36 buf_rchild_id = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
37 buf_lchild_flag = std::make_unique<sycl::buffer<u8>>(internal_cell_count);
38 buf_rchild_flag = std::make_unique<sycl::buffer<u8>>(internal_cell_count);
39 buf_endrange = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
51 one_cell_mode =
false;
54 template<
class u_morton>
55 void TreeStructure<u_morton>::build_one_cell_mode() {
56 internal_cell_count = 1;
57 buf_lchild_id = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
58 buf_rchild_id = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
59 buf_lchild_flag = std::make_unique<sycl::buffer<u8>>(internal_cell_count);
60 buf_rchild_flag = std::make_unique<sycl::buffer<u8>>(internal_cell_count);
61 buf_endrange = std::make_unique<sycl::buffer<u32>>(internal_cell_count);
64 sycl::host_accessor rchild_id{*buf_rchild_id, sycl::write_only, sycl::no_init};
65 sycl::host_accessor lchild_id{*buf_lchild_id, sycl::write_only, sycl::no_init};
66 sycl::host_accessor rchild_flag{*buf_rchild_flag, sycl::write_only, sycl::no_init};
67 sycl::host_accessor lchild_flag{*buf_lchild_flag, sycl::write_only, sycl::no_init};
68 sycl::host_accessor endrange{*buf_endrange, sycl::write_only, sycl::no_init};
80 template<
class u_morton>
82 : internal_cell_count(other.internal_cell_count), one_cell_mode(other.one_cell_mode),
84 shamalgs::memory::duplicate(
86 other.buf_lchild_id)),
88 shamalgs::memory::duplicate(
90 other.buf_rchild_id)),
92 shamalgs::memory::duplicate(
94 other.buf_lchild_flag)),
96 shamalgs::memory::duplicate(
98 other.buf_rchild_flag)),
100 shamalgs::memory::duplicate(
105 template<
class u_morton>
106 bool TreeStructure<u_morton>::operator==(
const TreeStructure<u_morton> &rhs)
const {
109 cmp = cmp && (internal_cell_count == rhs.internal_cell_count);
116 internal_cell_count);
122 internal_cell_count);
127 *rhs.buf_lchild_flag,
128 internal_cell_count);
133 *rhs.buf_rchild_flag,
134 internal_cell_count);
140 internal_cell_count);
141 cmp = cmp && (one_cell_mode == rhs.one_cell_mode);
146 template class TreeStructure<u32>;
147 template class TreeStructure<u64>;
Header file describing a Node Instance.
sycl::queue & get_compute_queue(u32 id=0)
std::uint32_t u32
32 bit unsigned integer
Element-wise equality comparison algorithms for buffers.
void sycl_karras_alg(sycl::queue &queue, u32 internal_cell_count, sycl::buffer< u_morton > &in_morton, sycl::buffer< u32 > &out_buf_lchild_id, sycl::buffer< u32 > &out_buf_rchild_id, sycl::buffer< u8 > &out_buf_lchild_flag, sycl::buffer< u8 > &out_buf_rchild_flag, sycl::buffer< u32 > &out_buf_endrange)
Karras 2012 algorithm with addition endrange buffer.
bool equals(sycl::queue &q, sycl::buffer< T > &buf1, sycl::buffer< T > &buf2, u32 cnt)
Compare elements between two sycl::buffers for equality.
ExcptTypes make_except_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Create an exception with a message and a location.