From 08e3254dae295c636aeafc4c386f155d64338535 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 20 Aug 2022 00:52:24 -0600 Subject: [PATCH] brushbsp: track tree level for debugging --- qbsp/brushbsp.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qbsp/brushbsp.cc b/qbsp/brushbsp.cc index eaa14d17..c5438aee 100644 --- a/qbsp/brushbsp.cc +++ b/qbsp/brushbsp.cc @@ -1119,7 +1119,7 @@ BuildTree_r Called in parallel. ================== */ -static void BuildTree_r(tree_t &tree, node_t *node, bspbrush_t::container brushes, tree_split_t split_type, bspstats_t &stats, logging::percent_clock &clock) +static void BuildTree_r(tree_t &tree, int level, node_t *node, bspbrush_t::container brushes, tree_split_t split_type, bspstats_t &stats, logging::percent_clock &clock) { // find the best plane to use as a splitter auto *bestside = SelectSplitPlane(brushes, node, split_type, stats); @@ -1173,8 +1173,8 @@ static void BuildTree_r(tree_t &tree, node_t *node, bspbrush_t::container brushe // recursively process children tbb::task_group g; - g.run([&]() { BuildTree_r(tree, node->children[0], std::move(children[0]), split_type, stats, clock); }); - g.run([&]() { BuildTree_r(tree, node->children[1], std::move(children[1]), split_type, stats, clock); }); + g.run([&]() { BuildTree_r(tree, level + 1, node->children[0], std::move(children[0]), split_type, stats, clock); }); + g.run([&]() { BuildTree_r(tree, level + 1, node->children[1], std::move(children[1]), split_type, stats, clock); }); g.wait(); } @@ -1267,7 +1267,7 @@ void BrushBSP(tree_t &tree, mapentity_t &entity, const bspbrush_t::container &br { logging::percent_clock clock; - BuildTree_r(tree, tree.headnode, brushlist, split_type, stats, clock); + BuildTree_r(tree, 0, tree.headnode, brushlist, split_type, stats, clock); } logging::header("CountLeafs");