qbsp: add -nothreads debug option
This commit is contained in:
parent
29652b4a7a
commit
ff7f8a1542
|
|
@ -391,6 +391,7 @@ public:
|
||||||
bool fLeakTest;
|
bool fLeakTest;
|
||||||
bool fContentHack;
|
bool fContentHack;
|
||||||
vec_t worldExtent;
|
vec_t worldExtent;
|
||||||
|
bool fNoThreads;
|
||||||
|
|
||||||
options_t() :
|
options_t() :
|
||||||
fNofill(false),
|
fNofill(false),
|
||||||
|
|
@ -432,7 +433,8 @@ public:
|
||||||
fTestExpand(false),
|
fTestExpand(false),
|
||||||
fLeakTest(false),
|
fLeakTest(false),
|
||||||
fContentHack(false),
|
fContentHack(false),
|
||||||
worldExtent(65536.0f) {}
|
worldExtent(65536.0f),
|
||||||
|
fNoThreads(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern options_t options;
|
extern options_t options;
|
||||||
|
|
|
||||||
12
qbsp/qbsp.cc
12
qbsp/qbsp.cc
|
|
@ -19,12 +19,15 @@
|
||||||
See file, 'COPYING', for details.
|
See file, 'COPYING', for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <common/log.hh>
|
#include <common/log.hh>
|
||||||
#include <qbsp/qbsp.hh>
|
#include <qbsp/qbsp.hh>
|
||||||
#include <qbsp/wad.hh>
|
#include <qbsp/wad.hh>
|
||||||
|
|
||||||
|
#include "tbb/global_control.h"
|
||||||
|
|
||||||
static const char *IntroString =
|
static const char *IntroString =
|
||||||
"---- qbsp / ericw-tools " stringify(ERICWTOOLS_VERSION) " ----\n";
|
"---- qbsp / ericw-tools " stringify(ERICWTOOLS_VERSION) " ----\n";
|
||||||
|
|
||||||
|
|
@ -714,6 +717,7 @@ PrintOptions(void)
|
||||||
" -expand Write hull 1 expanded brushes to expanded.map for debugging\n"
|
" -expand Write hull 1 expanded brushes to expanded.map for debugging\n"
|
||||||
" -leaktest Make compilation fail if the map leaks\n"
|
" -leaktest Make compilation fail if the map leaks\n"
|
||||||
" -contenthack Hack to fix leaks through solids. Causes missing faces in some cases so disabled by default.\n"
|
" -contenthack Hack to fix leaks through solids. Causes missing faces in some cases so disabled by default.\n"
|
||||||
|
" -nothreads Disable multithreading\n"
|
||||||
" sourcefile .MAP file to process\n"
|
" sourcefile .MAP file to process\n"
|
||||||
" destfile .BSP file to output\n");
|
" destfile .BSP file to output\n");
|
||||||
|
|
||||||
|
|
@ -944,6 +948,8 @@ ParseOptions(char *szOptions)
|
||||||
options.fLeakTest = true;
|
options.fLeakTest = true;
|
||||||
} else if (!Q_strcasecmp(szTok, "contenthack")) {
|
} else if (!Q_strcasecmp(szTok, "contenthack")) {
|
||||||
options.fContentHack = true;
|
options.fContentHack = true;
|
||||||
|
} else if (!Q_strcasecmp(szTok, "nothreads")) {
|
||||||
|
options.fNoThreads = true;
|
||||||
} else if (!Q_strcasecmp(szTok, "?") || !Q_strcasecmp(szTok, "help"))
|
} else if (!Q_strcasecmp(szTok, "?") || !Q_strcasecmp(szTok, "help"))
|
||||||
PrintOptions();
|
PrintOptions();
|
||||||
else
|
else
|
||||||
|
|
@ -1064,6 +1070,12 @@ int qbsp_main(int argc, const char **argv)
|
||||||
|
|
||||||
InitQBSP(argc, argv);
|
InitQBSP(argc, argv);
|
||||||
|
|
||||||
|
// disable TBB if requested
|
||||||
|
auto tbbOptions = std::unique_ptr<tbb::global_control>();
|
||||||
|
if (options.fNoThreads) {
|
||||||
|
tbbOptions = std::make_unique<tbb::global_control>(tbb::global_control::max_allowed_parallelism, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// do it!
|
// do it!
|
||||||
start = I_FloatTime();
|
start = I_FloatTime();
|
||||||
ProcessFile();
|
ProcessFile();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue