| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// SPDX-License-Identifier: BSD-3-Clause |
| 2 |
|
|
#include "chrono_batch_render/bvh/reference.h" |
| 3 |
|
|
|
| 4 |
|
|
#include <algorithm> |
| 5 |
|
|
#include <array> |
| 6 |
|
|
#include <cstdint> |
| 7 |
|
|
#include <cstring> |
| 8 |
|
|
#include <limits> |
| 9 |
|
|
#include <type_traits> |
| 10 |
|
|
#include <vector> |
| 11 |
|
|
|
| 12 |
|
|
#include "chrono_batch_render/util/error.h" |
| 13 |
|
|
|
| 14 |
|
|
namespace chrono::batch_render::bvh { |
| 15 |
|
|
|
| 16 |
|
|
namespace { |
| 17 |
|
|
|
| 18 |
|
|
using Point = std::array<float, 3>; |
| 19 |
|
|
|
| 20 |
|
|
constexpr int kBins = 16; |
| 21 |
|
|
constexpr double kNodeCost = 1; |
| 22 |
|
|
constexpr double kRecordCost = 0.3; |
| 23 |
|
|
|
| 24 |
|
789550 |
void Grow(BvhBox& box, const BvhBox& other) { |
| 25 |
|
789550 |
box = BvhUnion(box, other); |
| 26 |
|
789550 |
} |
| 27 |
|
|
|
| 28 |
|
140588 |
void Grow(BvhBox& box, const Point& point) { |
| 29 |
|
140588 |
Grow(box, BvhBox{{point[0], point[1], point[2]}, {point[0], point[1], point[2]}}); |
| 30 |
|
140588 |
} |
| 31 |
|
|
|
| 32 |
|
13452 |
Point Center(const BvhBox& box) { |
| 33 |
|
13452 |
return {BvhCenter(box, 0), BvhCenter(box, 1), BvhCenter(box, 2)}; |
| 34 |
|
|
} |
| 35 |
|
|
|
| 36 |
|
14 |
struct Binary { |
| 37 |
|
|
BvhBox box = BvhEmptyBox(); |
| 38 |
|
|
uint32_t left = 0; |
| 39 |
|
|
uint32_t right = 0; |
| 40 |
|
|
uint32_t first = 0; |
| 41 |
|
|
uint32_t count = 0; |
| 42 |
|
|
}; |
| 43 |
|
|
|
| 44 |
|
|
template <class Record, class MakeRecord> class ReferenceBuilder { |
| 45 |
|
|
public: |
| 46 |
|
15 |
ReferenceBuilder(std::vector<BvhBox> boxes, MakeRecord makeRecord) |
| 47 |
|
15 |
: m_boxes(std::move(boxes)), m_makeRecord(std::move(makeRecord)) {} |
| 48 |
|
|
|
| 49 |
|
15 |
std::vector<std::byte> Build() { |
| 50 |
|
15 |
BvhHeader header{}; |
| 51 |
|
15 |
header.version = kBvhVersion; |
| 52 |
|
3 |
header.kind = std::is_same_v<Record, BvhInstance> ? kBvhInstances |
| 53 |
|
|
: std::is_same_v<Record, BvhBoxRecord> ? kBvhBoxes |
| 54 |
|
|
: kBvhTriangles; |
| 55 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 time.
|
15 |
header.primitives = uint32_t(m_boxes.size()); |
| 56 |
|
15 |
header.nodes = sizeof(BvhHeader); |
| 57 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 1 time.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 1 time.
|
15 |
if (!m_boxes.empty()) { |
| 58 |
|
14 |
BuildBinary(); |
| 59 |
|
14 |
Collapse(); |
| 60 |
|
14 |
Encode(); |
| 61 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Build():
✓ Branch 0 taken 33 times.
✓ Branch 1 taken 11 times.
|
56 |
for (int i = 0; i < 3; ++i) { |
| 62 |
|
42 |
header.lower[i] = m_binary[0].box.lower[i]; |
| 63 |
|
42 |
header.upper[i] = m_binary[0].box.upper[i]; |
| 64 |
|
|
} |
| 65 |
|
|
} |
| 66 |
|
|
|
| 67 |
|
15 |
header.nodeCount = uint32_t(m_nodes.size()); |
| 68 |
|
15 |
header.leafCount = uint32_t(m_records.size()); |
| 69 |
|
15 |
header.leaves = header.nodes + m_nodes.size() * sizeof(BvhNode); |
| 70 |
|
|
|
| 71 |
|
15 |
std::vector<std::byte> bytes(header.leaves + m_records.size() * sizeof(Record)); |
| 72 |
|
15 |
std::memcpy(bytes.data(), &header, sizeof(header)); |
| 73 |
|
15 |
std::memcpy(bytes.data() + header.nodes, m_nodes.data(), m_nodes.size() * sizeof(BvhNode)); |
| 74 |
|
15 |
std::memcpy(bytes.data() + header.leaves, m_records.data(), |
| 75 |
|
15 |
m_records.size() * sizeof(Record)); |
| 76 |
|
15 |
return bytes; |
| 77 |
|
|
} |
| 78 |
|
|
|
| 79 |
|
|
private: |
| 80 |
|
14 |
void BuildBinary() { |
| 81 |
|
14 |
const auto count = uint32_t(m_boxes.size()); |
| 82 |
|
14 |
m_centers.resize(count); |
| 83 |
|
14 |
m_order.resize(count); |
| 84 |
|
14 |
Binary root; |
| 85 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 300 times.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 12942 times.
✓ Branch 1 taken 11 times.
|
13466 |
for (uint32_t i = 0; i < count; ++i) { |
| 86 |
|
13452 |
m_centers[i] = Center(m_boxes[i]); |
| 87 |
|
13452 |
m_order[i] = i; |
| 88 |
|
13452 |
Grow(root.box, m_boxes[i]); |
| 89 |
|
|
} |
| 90 |
|
14 |
root.count = count; |
| 91 |
|
14 |
m_binary.push_back(root); |
| 92 |
|
|
|
| 93 |
|
14 |
std::vector<uint32_t> pending = {0}; |
| 94 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 255 times.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 186 times.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 0 taken 11131 times.
✓ Branch 1 taken 11 times.
|
11600 |
while (!pending.empty()) { |
| 95 |
|
11572 |
const uint32_t index = pending.back(); |
| 96 |
|
11572 |
pending.pop_back(); |
| 97 |
9/9
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 255 times.
✓ Branch 3 taken 127 times.
✓ Branch 4 taken 128 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 186 times.
✓ Branch 3 taken 92 times.
✓ Branch 4 taken 94 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 11131 times.
✓ Branch 3 taken 5560 times.
✓ Branch 4 taken 5571 times.
|
11572 |
if (Split(index)) { |
| 98 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 5560 times.
|
5779 |
pending.push_back(m_binary[index].left); |
| 99 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BuildBinary():
✓ Branch 1 taken 5560 times.
|
5779 |
pending.push_back(m_binary[index].right); |
| 100 |
|
|
} |
| 101 |
|
|
} |
| 102 |
|
14 |
} |
| 103 |
|
|
|
| 104 |
|
5779 |
struct SplitChoice { |
| 105 |
|
|
int axis = -1; |
| 106 |
|
|
int bin = 0; |
| 107 |
|
|
BvhBox centers = BvhEmptyBox(); |
| 108 |
|
|
}; |
| 109 |
|
|
|
| 110 |
|
5779 |
SplitChoice BestSplit(const Binary& node) const { |
| 111 |
|
5779 |
SplitChoice best; |
| 112 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 2125 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 1349 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 137114 times.
✓ Branch 1 taken 5560 times.
|
146367 |
for (uint32_t i = node.first; i < node.first + node.count; ++i) { |
| 113 |
|
140588 |
Grow(best.centers, m_centers[m_order[i]]); |
| 114 |
|
|
} |
| 115 |
|
|
|
| 116 |
|
|
float bestCost = std::numeric_limits<float>::max(); |
| 117 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 381 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 276 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 16680 times.
✓ Branch 1 taken 5560 times.
|
23116 |
for (int axis = 0; axis < 3; ++axis) { |
| 118 |
|
17337 |
const float extent = best.centers.upper[axis] - best.centers.lower[axis]; |
| 119 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 381 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 8320 times.
✓ Branch 1 taken 8360 times.
|
17337 |
if (!(extent > 0)) { |
| 120 |
|
8320 |
continue; |
| 121 |
|
|
} |
| 122 |
|
|
BvhBox boxes[kBins]; |
| 123 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 6096 times.
✓ Branch 1 taken 381 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 276 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 133760 times.
✓ Branch 1 taken 8360 times.
|
153289 |
std::fill(std::begin(boxes), std::end(boxes), BvhEmptyBox()); |
| 124 |
|
9017 |
uint32_t counts[kBins] = {}; |
| 125 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 6375 times.
✓ Branch 1 taken 381 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 4047 times.
✓ Branch 1 taken 276 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 213990 times.
✓ Branch 1 taken 8360 times.
|
233429 |
for (uint32_t i = node.first; i < node.first + node.count; ++i) { |
| 126 |
|
224412 |
const int bin = Bin(m_centers[m_order[i]][axis], best.centers.lower[axis], extent); |
| 127 |
|
224412 |
Grow(boxes[bin], m_boxes[m_order[i]]); |
| 128 |
|
224412 |
++counts[bin]; |
| 129 |
|
|
} |
| 130 |
|
|
|
| 131 |
|
|
float leftArea[kBins - 1]; |
| 132 |
|
|
uint32_t leftCount[kBins - 1]; |
| 133 |
|
144272 |
BvhBox left = BvhEmptyBox(); |
| 134 |
|
|
uint32_t below = 0; |
| 135 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 5715 times.
✓ Branch 1 taken 381 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 4140 times.
✓ Branch 1 taken 276 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 125400 times.
✓ Branch 1 taken 8360 times.
|
144272 |
for (int bin = 0; bin < kBins - 1; ++bin) { |
| 136 |
|
135255 |
Grow(left, boxes[bin]); |
| 137 |
|
135255 |
below += counts[bin]; |
| 138 |
|
135255 |
leftArea[bin] = BvhArea(left); |
| 139 |
|
135255 |
leftCount[bin] = below; |
| 140 |
|
|
} |
| 141 |
|
|
|
| 142 |
|
144272 |
BvhBox right = BvhEmptyBox(); |
| 143 |
|
|
uint32_t above = 0; |
| 144 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 5715 times.
✓ Branch 1 taken 381 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 4140 times.
✓ Branch 1 taken 276 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 125400 times.
✓ Branch 1 taken 8360 times.
|
144272 |
for (int bin = kBins - 1; bin > 0; --bin) { |
| 145 |
|
135255 |
Grow(right, boxes[bin]); |
| 146 |
|
135255 |
above += counts[bin]; |
| 147 |
6/12
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 5715 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5715 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 4140 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4140 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 125400 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125400 times.
|
135255 |
if (leftCount[bin - 1] == 0 || above == 0) { |
| 148 |
|
✗ |
continue; |
| 149 |
|
|
} |
| 150 |
|
135255 |
const float cost = |
| 151 |
|
135255 |
leftArea[bin - 1] * float(leftCount[bin - 1]) + BvhArea(right) * float(above); |
| 152 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 579 times.
✓ Branch 1 taken 5136 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 421 times.
✓ Branch 1 taken 3719 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::BestSplit(chrono::batch_render::bvh::(anonymous namespace)::Binary const&) const:
✓ Branch 0 taken 13723 times.
✓ Branch 1 taken 111677 times.
|
135255 |
if (cost < bestCost) { |
| 153 |
|
14723 |
bestCost = cost; |
| 154 |
|
14723 |
best.axis = axis; |
| 155 |
|
14723 |
best.bin = bin; |
| 156 |
|
|
} |
| 157 |
|
|
} |
| 158 |
|
|
} |
| 159 |
|
5779 |
return best; |
| 160 |
|
|
} |
| 161 |
|
|
|
| 162 |
|
11572 |
bool Split(uint32_t index) { |
| 163 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 127 times.
✓ Branch 1 taken 128 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 94 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 5560 times.
✓ Branch 1 taken 5571 times.
|
11572 |
const Binary node = m_binary[index]; |
| 164 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 127 times.
✓ Branch 1 taken 128 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 94 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 5560 times.
✓ Branch 1 taken 5571 times.
|
11572 |
if (node.count <= kBvhLeafSize) { |
| 165 |
|
|
return false; |
| 166 |
|
|
} |
| 167 |
|
5779 |
const SplitChoice best = BestSplit(node); |
| 168 |
|
|
uint32_t middle; |
| 169 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 3498 times.
✓ Branch 1 taken 2062 times.
|
5779 |
if (best.axis >= 0) { |
| 170 |
|
3717 |
const float lower = best.centers.lower[best.axis]; |
| 171 |
|
3717 |
const float extent = best.centers.upper[best.axis] - lower; |
| 172 |
|
7434 |
const auto split = std::partition( |
| 173 |
|
3717 |
m_order.begin() + node.first, m_order.begin() + node.first + node.count, |
| 174 |
|
|
[&](uint32_t primitive) { |
| 175 |
|
|
return Bin(m_centers[primitive][best.axis], lower, extent) < best.bin; |
| 176 |
|
|
}); |
| 177 |
|
3717 |
middle = uint32_t(split - m_order.begin()); |
| 178 |
|
|
} else { |
| 179 |
|
2062 |
middle = node.first + node.count / 2; |
| 180 |
|
|
} |
| 181 |
|
|
|
| 182 |
|
5779 |
Binary left{.first = node.first, .count = middle - node.first}; |
| 183 |
|
5779 |
Binary right{.first = middle, .count = node.first + node.count - middle}; |
| 184 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 254 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 184 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 11120 times.
✓ Branch 1 taken 5560 times.
|
17337 |
for (Binary* child : {&left, &right}) { |
| 185 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 2125 times.
✓ Branch 1 taken 254 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 1349 times.
✓ Branch 1 taken 184 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Split(unsigned int):
✓ Branch 0 taken 137114 times.
✓ Branch 1 taken 11120 times.
|
152146 |
for (uint32_t i = child->first; i < child->first + child->count; ++i) { |
| 186 |
|
140588 |
Grow(child->box, m_boxes[m_order[i]]); |
| 187 |
|
|
} |
| 188 |
|
|
} |
| 189 |
|
|
|
| 190 |
|
5779 |
m_binary[index].left = uint32_t(m_binary.size()); |
| 191 |
|
5779 |
m_binary.push_back(left); |
| 192 |
|
5779 |
m_binary[index].right = uint32_t(m_binary.size()); |
| 193 |
|
5779 |
m_binary.push_back(right); |
| 194 |
|
5779 |
m_binary[index].count = 0; |
| 195 |
|
5779 |
return true; |
| 196 |
|
|
} |
| 197 |
|
|
|
| 198 |
|
309840 |
static int Bin(float center, float lower, float extent) { |
| 199 |
|
309840 |
const float at = (center - lower) * (float(kBins) / extent); |
| 200 |
15/18
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Bin(float, float, float):
✓ Branch 0 taken 7992 times.
✓ Branch 1 taken 508 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7992 times.
✓ Branch 4 taken 6928 times.
✓ Branch 5 taken 1064 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Bin(float, float, float):
✓ Branch 0 taken 5028 times.
✓ Branch 1 taken 368 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5028 times.
✓ Branch 4 taken 4336 times.
✓ Branch 5 taken 692 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Bin(float, float, float):
✓ Branch 0 taken 277544 times.
✓ Branch 1 taken 18400 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 277544 times.
✓ Branch 4 taken 245667 times.
✓ Branch 5 taken 31877 times.
|
566771 |
return at > 0 ? std::min(kBins - 1, int(std::min(at, float(kBins)))) : 0; |
| 201 |
|
|
} |
| 202 |
|
|
|
| 203 |
|
14 |
void Collapse() { |
| 204 |
|
14 |
const auto count = uint32_t(m_binary.size()); |
| 205 |
|
14 |
m_first.assign(count, 0); |
| 206 |
|
14 |
m_count.assign(count, 0); |
| 207 |
|
14 |
m_costs.assign(count, {}); |
| 208 |
|
14 |
m_splits.assign(count, {}); |
| 209 |
|
14 |
m_leaf.assign(count, false); |
| 210 |
|
14 |
constexpr double kNever = std::numeric_limits<double>::infinity(); |
| 211 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 9 times.
|
14 |
const double floor = std::max(double(BvhArea(m_binary[0].box)) * 1e-6, 1e-30); |
| 212 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 255 times.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 186 times.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 11131 times.
✓ Branch 1 taken 11 times.
|
11586 |
for (uint32_t n = count; n-- > 0;) { |
| 213 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 94 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 5571 times.
✓ Branch 1 taken 5560 times.
|
11572 |
const Binary& node = m_binary[n]; |
| 214 |
|
11572 |
const double area = BvhArea(node.box) + floor; |
| 215 |
|
11572 |
std::array<double, kBvhWidth + 1>& costs = m_costs[n]; |
| 216 |
|
11572 |
std::array<uint8_t, kBvhWidth + 1>& splits = m_splits[n]; |
| 217 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 94 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 5571 times.
✓ Branch 1 taken 5560 times.
|
11572 |
if (node.count > 0) { |
| 218 |
|
5793 |
m_first[n] = node.first; |
| 219 |
|
5793 |
m_count[n] = node.count; |
| 220 |
|
5793 |
m_leaf[n] = true; |
| 221 |
|
5793 |
costs.fill(kRecordCost * area * node.count); |
| 222 |
|
5793 |
continue; |
| 223 |
|
|
} |
| 224 |
6/12
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 127 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 5560 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5560 times.
|
5779 |
m_first[n] = std::min(m_first[node.left], m_first[node.right]); |
| 225 |
|
5779 |
m_count[n] = m_count[node.left] + m_count[node.right]; |
| 226 |
|
5779 |
const auto& left = m_costs[node.left]; |
| 227 |
|
5779 |
const auto& right = m_costs[node.right]; |
| 228 |
|
5779 |
const auto best = [&](uint32_t slots) { |
| 229 |
|
|
std::pair<double, uint8_t> found = {kNever, 0}; |
| 230 |
|
|
for (uint32_t k = 1; k < slots; ++k) { |
| 231 |
|
|
found = std::min(found, {left[k] + right[slots - k], uint8_t(k)}); |
| 232 |
|
|
} |
| 233 |
|
|
return found; |
| 234 |
|
|
}; |
| 235 |
3/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 5560 times.
|
5779 |
const auto [inside, split] = best(kBvhWidth); |
| 236 |
|
5779 |
splits[0] = split; |
| 237 |
|
5779 |
const double leaf = |
| 238 |
3/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✗ Branch 0 not taken.
✓ Branch 1 taken 5560 times.
|
5779 |
m_count[n] <= kBvhLeafSize ? kRecordCost * area * m_count[n] : kNever; |
| 239 |
|
5779 |
m_leaf[n] = leaf <= kNodeCost * area + inside; |
| 240 |
3/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 5560 times.
✗ Branch 1 not taken.
|
5779 |
costs[1] = std::min(leaf, kNodeCost * area + inside); |
| 241 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 889 times.
✓ Branch 1 taken 127 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 644 times.
✓ Branch 1 taken 92 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 38920 times.
✓ Branch 1 taken 5560 times.
|
46232 |
for (uint32_t slots = 2; slots <= kBvhWidth; ++slots) { |
| 242 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 374 times.
✓ Branch 1 taken 515 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 247 times.
✓ Branch 1 taken 397 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 11291 times.
✓ Branch 1 taken 27629 times.
|
40453 |
const auto [cost, k] = best(slots); |
| 243 |
12/12
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 374 times.
✓ Branch 1 taken 515 times.
✓ Branch 2 taken 374 times.
✓ Branch 3 taken 515 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 247 times.
✓ Branch 1 taken 397 times.
✓ Branch 2 taken 247 times.
✓ Branch 3 taken 397 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 11291 times.
✓ Branch 1 taken 27629 times.
✓ Branch 2 taken 11291 times.
✓ Branch 3 taken 27629 times.
|
52365 |
costs[slots] = std::min(costs[slots - 1], cost); |
| 244 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 374 times.
✓ Branch 1 taken 515 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 247 times.
✓ Branch 1 taken 397 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Collapse():
✓ Branch 0 taken 11291 times.
✓ Branch 1 taken 27629 times.
|
40453 |
splits[slots] = cost < costs[slots - 1] ? k : 0; |
| 245 |
|
|
} |
| 246 |
|
|
} |
| 247 |
|
14 |
} |
| 248 |
|
|
|
| 249 |
|
11558 |
void Gather(uint32_t index, uint32_t slots, std::vector<uint32_t>& children) const { |
| 250 |
|
11558 |
const Binary& node = m_binary[index]; |
| 251 |
18/18
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 152 times.
✓ Branch 1 taken 151 times.
✓ Branch 2 taken 146 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 49 times.
✓ Branch 5 taken 97 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 90 times.
✓ Branch 1 taken 106 times.
✓ Branch 2 taken 87 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 75 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 5137 times.
✓ Branch 1 taken 6395 times.
✓ Branch 2 taken 5022 times.
✓ Branch 3 taken 115 times.
✓ Branch 4 taken 412 times.
✓ Branch 5 taken 4610 times.
|
12031 |
while (slots > 1 && node.count == 0 && m_splits[index][slots] == 0) { |
| 252 |
|
473 |
--slots; |
| 253 |
|
|
} |
| 254 |
12/12
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 103 times.
✓ Branch 1 taken 151 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 97 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 78 times.
✓ Branch 1 taken 106 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 75 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Gather(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int> >&) const:
✓ Branch 0 taken 4725 times.
✓ Branch 1 taken 6395 times.
✓ Branch 2 taken 115 times.
✓ Branch 3 taken 4610 times.
|
11558 |
if (slots == 1 || node.count > 0) { |
| 255 |
|
6776 |
children.push_back(index); |
| 256 |
|
6776 |
return; |
| 257 |
|
|
} |
| 258 |
|
4782 |
const uint32_t k = m_splits[index][slots]; |
| 259 |
|
4782 |
Gather(node.left, k, children); |
| 260 |
|
4782 |
Gather(node.right, slots - k, children); |
| 261 |
|
|
} |
| 262 |
|
|
|
| 263 |
|
998 |
std::vector<uint32_t> Children(uint32_t index) const { |
| 264 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 950 times.
|
998 |
const Binary& node = m_binary[index]; |
| 265 |
4/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 950 times.
|
998 |
if (node.count > 0) { |
| 266 |
|
1 |
return {index}; |
| 267 |
|
|
} |
| 268 |
|
997 |
std::vector<uint32_t> children; |
| 269 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 950 times.
|
997 |
const uint32_t k = m_splits[index][0]; |
| 270 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 950 times.
|
997 |
Gather(node.left, k, children); |
| 271 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Children(unsigned int) const:
✓ Branch 1 taken 950 times.
|
997 |
Gather(node.right, kBvhWidth - k, children); |
| 272 |
|
997 |
return children; |
| 273 |
|
997 |
} |
| 274 |
|
|
|
| 275 |
|
14 |
void Encode() { |
| 276 |
|
14 |
m_nodes.emplace_back(); |
| 277 |
|
14 |
std::vector<std::pair<uint32_t, uint32_t>> pending = {{0, 0}}; |
| 278 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1 time.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 2 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 951 times.
✓ Branch 1 taken 11 times.
|
1012 |
while (!pending.empty()) { |
| 279 |
|
998 |
const auto [binary, at] = pending.back(); |
| 280 |
|
998 |
pending.pop_back(); |
| 281 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 951 times.
|
998 |
const std::vector<uint32_t> children = Children(binary); |
| 282 |
|
998 |
const BvhBox& box = m_binary[binary].box; |
| 283 |
|
|
BvhBox boxes[kBvhWidth]; |
| 284 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 157 times.
✓ Branch 1 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 109 times.
✓ Branch 1 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 6511 times.
✓ Branch 1 taken 951 times.
|
7775 |
for (size_t i = 0; i < children.size(); ++i) { |
| 285 |
|
6777 |
boxes[i] = m_binary[children[i]].box; |
| 286 |
|
|
} |
| 287 |
|
998 |
const BvhSlots slots = BvhAssignSlots(box, boxes, uint32_t(children.size())); |
| 288 |
|
998 |
BvhNode node = BvhQuantize(box, boxes, slots); |
| 289 |
|
|
|
| 290 |
|
998 |
uint32_t imask = 0; |
| 291 |
|
998 |
uint32_t internal = 0; |
| 292 |
|
998 |
uint32_t records = 0; |
| 293 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 240 times.
✓ Branch 2 taken 30 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 136 times.
✓ Branch 2 taken 17 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 7608 times.
✓ Branch 2 taken 951 times.
|
8982 |
for (uint32_t slot = 0; slot < kBvhWidth; ++slot) { |
| 294 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 83 times.
✓ Branch 1 taken 157 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 109 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 1097 times.
✓ Branch 1 taken 6511 times.
|
7984 |
if (slots.child[slot] == kBvhEmptySlot) { |
| 295 |
|
1207 |
continue; |
| 296 |
|
|
} |
| 297 |
|
6777 |
const uint32_t index = children[slots.child[slot]]; |
| 298 |
|
|
uint32_t meta; |
| 299 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 128 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 94 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 940 times.
✓ Branch 2 taken 5571 times.
|
6777 |
if (!m_leaf[index]) { |
| 300 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 20 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 10 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 202 times.
✓ Branch 1 taken 738 times.
|
984 |
if (internal++ == 0) { |
| 301 |
|
216 |
node.firstChild = uint32_t(m_nodes.size()); |
| 302 |
|
|
} |
| 303 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 29 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 15 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 940 times.
|
984 |
imask |= 1u << slot; |
| 304 |
|
984 |
meta = BvhInternalMeta(slot); |
| 305 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 29 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 15 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 940 times.
|
984 |
pending.emplace_back(index, uint32_t(m_nodes.size())); |
| 306 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 29 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 15 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 940 times.
|
984 |
m_nodes.emplace_back(); |
| 307 |
|
|
} else { |
| 308 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 99 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 78 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 873 times.
✓ Branch 1 taken 4698 times.
|
5793 |
if (records == 0) { |
| 309 |
|
918 |
node.firstLeaf = uint32_t(m_records.size() * sizeof(Record) / 16); |
| 310 |
|
|
} |
| 311 |
|
5793 |
meta = BvhLeafMeta(m_count[index], records); |
| 312 |
|
5793 |
records += m_count[index]; |
| 313 |
6/6
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 300 times.
✓ Branch 1 taken 128 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 94 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 0 taken 12942 times.
✓ Branch 1 taken 5571 times.
|
19245 |
for (uint32_t i = m_first[index]; i < m_first[index] + m_count[index]; ++i) { |
| 314 |
3/3
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 300 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 210 times.
chrono::batch_render::bvh::(anonymous namespace)::ReferenceBuilder<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>::Encode():
✓ Branch 1 taken 12942 times.
|
13452 |
m_records.push_back(m_makeRecord(m_order[i])); |
| 315 |
|
|
} |
| 316 |
|
|
} |
| 317 |
|
6777 |
node.meta[slot >> 2] = BvhWithByte(node.meta[slot >> 2], slot & 3, meta); |
| 318 |
|
|
} |
| 319 |
|
|
|
| 320 |
|
998 |
node.exponents |= imask << 24; |
| 321 |
|
998 |
m_nodes[at] = node; |
| 322 |
|
|
} |
| 323 |
|
14 |
} |
| 324 |
|
|
|
| 325 |
|
|
std::vector<BvhBox> m_boxes; |
| 326 |
|
|
MakeRecord m_makeRecord; |
| 327 |
|
|
std::vector<Point> m_centers; |
| 328 |
|
|
std::vector<uint32_t> m_order; |
| 329 |
|
|
std::vector<Binary> m_binary; |
| 330 |
|
|
std::vector<uint32_t> m_first; |
| 331 |
|
|
std::vector<uint32_t> m_count; |
| 332 |
|
|
std::vector<std::array<double, kBvhWidth + 1>> m_costs; |
| 333 |
|
|
std::vector<std::array<uint8_t, kBvhWidth + 1>> m_splits; |
| 334 |
|
|
std::vector<bool> m_leaf; |
| 335 |
|
|
std::vector<BvhNode> m_nodes; |
| 336 |
|
|
std::vector<Record> m_records; |
| 337 |
|
|
}; |
| 338 |
|
|
|
| 339 |
|
|
template <class Record, class MakeRecord> |
| 340 |
|
15 |
std::vector<std::byte> BuildBvh(std::vector<BvhBox> boxes, MakeRecord makeRecord) { |
| 341 |
3/3
std::vector<std::byte, std::allocator<std::byte> > chrono::batch_render::bvh::(anonymous namespace)::BuildBvh<chrono::batch_render::BvhBoxRecord, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>(std::vector<chrono::batch_render::BvhBox, std::allocator<chrono::batch_render::BvhBox> >, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}):
✓ Branch 2 taken 1 time.
std::vector<std::byte, std::allocator<std::byte> > chrono::batch_render::bvh::(anonymous namespace)::BuildBvh<chrono::batch_render::BvhInstance, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>(std::vector<chrono::batch_render::BvhBox, std::allocator<chrono::batch_render::BvhBox> >, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::InstanceRecord const, 18446744073709551615ul>, std::span<chrono::batch_render::BvhBox const, 18446744073709551615ul>)::{lambda(unsigned int)#1}):
✓ Branch 2 taken 2 times.
std::vector<std::byte, std::allocator<std::byte> > chrono::batch_render::bvh::(anonymous namespace)::BuildBvh<chrono::batch_render::BvhTriangle, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}>(std::vector<chrono::batch_render::BvhBox, std::allocator<chrono::batch_render::BvhBox> >, chrono::batch_render::bvh::BuildReference(std::span<chrono::batch_render::BvhCorners const, 18446744073709551615ul>)::{lambda(unsigned int)#1}):
✓ Branch 2 taken 12 times.
|
15 |
return ReferenceBuilder<Record, MakeRecord>(std::move(boxes), std::move(makeRecord)).Build(); |
| 342 |
|
|
} |
| 343 |
|
|
|
| 344 |
|
|
} |
| 345 |
|
|
|
| 346 |
|
12 |
std::vector<std::byte> BuildReference(std::span<const Triangle> triangles) { |
| 347 |
|
12 |
std::vector<BvhBox> boxes(triangles.size()); |
| 348 |
2/2
✓ Branch 0 taken 12942 times.
✓ Branch 1 taken 12 times.
|
12954 |
for (size_t i = 0; i < triangles.size(); ++i) { |
| 349 |
|
12942 |
boxes[i] = BvhTriangleBox(triangles[i]); |
| 350 |
|
|
} |
| 351 |
|
12 |
return BuildBvh<BvhTriangle>( |
| 352 |
1/1
✓ Branch 1 taken 12 times.
|
12966 |
std::move(boxes), [&](uint32_t index) { return BvhMakeTriangle(triangles[index], index); }); |
| 353 |
|
12 |
} |
| 354 |
|
|
|
| 355 |
|
1 |
std::vector<std::byte> BuildReference(std::span<const BvhBox> boxes) { |
| 356 |
|
1 |
return BuildBvh<BvhBoxRecord>(std::vector<BvhBox>(boxes.begin(), boxes.end()), |
| 357 |
1/1
✓ Branch 2 taken 1 time.
|
302 |
[&](uint32_t index) { return BvhMakeBox(boxes[index], index); }); |
| 358 |
|
|
} |
| 359 |
|
|
|
| 360 |
|
3 |
std::vector<std::byte> BuildReference(std::span<const InstanceRecord> instances, |
| 361 |
|
|
std::span<const BvhBox> bounds) { |
| 362 |
2/2
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 2 times.
|
3 |
if (bounds.size() != instances.size()) { |
| 363 |
|
1 |
throw Error("BuildReference of {} instances with {} bounds; it takes one an instance", |
| 364 |
1/1
✓ Branch 2 taken 1 time.
|
1 |
instances.size(), bounds.size()); |
| 365 |
|
|
} |
| 366 |
|
2 |
std::vector<BvhBox> boxes(instances.size()); |
| 367 |
2/2
✓ Branch 0 taken 210 times.
✓ Branch 1 taken 2 times.
|
212 |
for (size_t i = 0; i < instances.size(); ++i) { |
| 368 |
|
210 |
boxes[i] = BvhInstanceBox(instances[i], bounds[i]); |
| 369 |
|
|
} |
| 370 |
|
2 |
return BuildBvh<BvhInstance>( |
| 371 |
1/1
✓ Branch 1 taken 2 times.
|
4 |
std::move(boxes), [&](uint32_t index) { return BvhMakeInstance(instances[index], index); }); |
| 372 |
|
2 |
} |
| 373 |
|
|
|
| 374 |
|
|
} |
| 375 |
|
|
|